您好我htaccesss文件我把这个code,以确保我的目录索引文件设置为
v2013 / index.html的
所以我把这个code
的DirectoryIndex v2013 / index.html的
然后我想它看起来像mydomain/Welcome,所以我加..
RewriteEngine叙述上 重写规则^欢迎$ v2013 / index.html的[L]
我的问题是,为什么DirectoryIndex的不工作了..我怎么能告诉浏览器查找内部v2013的CSS,因为正在寻找根。 (我想是因为重写),所以我的页面UNSTYLE .. =(
在换句话说正在寻找www.domain/css/sheet.css insted的的
www.domain/v2013/css/sheet.css
答案的位置:
最后code
的DirectoryIndex v2013 / index.html的 RewriteEngine叙述上 #排除文件已经要求v2013 的RewriteCond%{REQUEST_URI}!^ / v2013 / 重写规则^ CSS /.*$ / v2013 / $ 0个 重写规则^ JS /.*$ / v2013 / $ 0个 重写规则^图像/.*$ / v2013 / $ 0个 重写规则^比恩韦尼$ v2013 / index.html的[L]解决方案
您可以添加一个额外的重写规则 =nofollow的> <$ C $,它重写 CSS / , JS / 和图片/ 文件以及
#排除文件已经要求v2013 的RewriteCond%{REQUEST_URI}!^ / v2013 / 重写规则^(?:CSS |图片| JS)/.*$ / v2013 / $ 0个Hello in my htaccesss file i put this code to ensure that my directory index file is set to
v2013/index.html
so i put this code
DirectoryIndex v2013/index.htmlThen i Want it to look like mydomain/Welcome, so i add..
RewriteEngine On RewriteRule ^Welcome$ v2013/index.html [L]My question is why DirectoryIndex not working anymore.. and how can i tell the browser to look for the css inside v2013, because is looking in the root. ( i think because of rewrite) SO MY PAGE IS UNSTYLE.. =(
In other words is looking for www.domain/css/sheet.css insted of
www.domain/v2013/css/sheet.css
THE ANSWER HERE:
FINAL CODE
DirectoryIndex v2013/index.html RewriteEngine On # exclude files already asking for v2013 RewriteCond %{REQUEST_URI} !^/v2013/ RewriteRule ^css/.*$ /v2013/$0 RewriteRule ^js/.*$ /v2013/$0 RewriteRule ^images/.*$ /v2013/$0 RewriteRule ^Bienvenido$ v2013/index.html [L]解决方案
You can add an additional RewriteRule, which rewrites the css/, js/ and images/ files as well
# exclude files already asking for v2013 RewriteCond %{REQUEST_URI} !^/v2013/ RewriteRule ^(?:css|images|js)/.*$ /v2013/$0
更多推荐
htaccess的DirectoryIndex的重定向寻找的CSS错了地方
发布评论