.htaccess中的mod_rewrite挡住了我的CSS [英] Htaccess mod_rewrite blocking my css
本文介绍了.htaccess中的mod_rewrite挡住了我的CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
获得htaccess的重写我的链接,这样更好的搜索引擎优化:
选项+了FollowSymLinks -MultiViews
RewriteEngine叙述上
的RewriteBase /
的RewriteCond%{REQUEST_URI} * /([^ /] +)/? [NC]
的RewriteCond%{REQUEST_URI}!指数\ .PHP [NC]
重写规则。* /index.php?cat=%1 [L,NC,QSA]
这重写
http://www.example.com/any/number/of/directories/lastDir
到
http://www.example.com/index.php?cat=lastDir
但我的CSS心不是工作,当我上传htaccess的到服务器上,也只是没有图像和css纯文本
尝试添加基本标记转换为HTML,但它不工作
<基地的HREF =http://www.example.com/>
解决方案
尝试使用
选项+了FollowSymLinks -MultiViews
RewriteEngine叙述上
的RewriteBase /
的RewriteCond%{REQUEST_URI} * /([^ /] +)/? [NC]
的RewriteCond%{REQUEST_URI} ^!(指数\ .PHP |机器人\ .TXT |张图片|字体| JS | CSS |脚本)[NC]
重写规则。* /index.php?cat=%1 [L,NC,QSA]
这将过滤掉某些类型的文件和目录,以确保资产不被重定向
Got htaccess rewriting my links for better seo like this:
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} .*/([^/]+)/? [NC]
RewriteCond %{REQUEST_URI} !index\.php [NC]
RewriteRule .* /index.php?cat=%1 [L,NC,QSA]
which rewrites
http://www.example.com/any/number/of/directories/lastDir
to:
http://www.example.com/index.php?cat=lastDir
but my css isnt working, when i upload htaccess to the server, there is just plain text without images and css
tried adding base tag into html, but its not working
<base href="http://www.example.com/">
解决方案
try using
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} .*/([^/]+)/? [NC]
RewriteCond %{REQUEST_URI} !^(index\.php|robots\.txt|img|font|js|css|scripts) [NC]
RewriteRule .* /index.php?cat=%1 [L,NC,QSA]
this will filter out certain file types and directories to make sure that assets are not redirected
这篇关于.htaccess中的mod_rewrite挡住了我的CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文