htaccess的DirectoryIndex的重定向寻找的CSS错了地方

编程入门 行业动态 更新时间:2024-10-24 12:22:49
本文介绍了htaccess的DirectoryIndex的重定向寻找的CSS错了地方的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

您好我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.html

Then 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错了地方

本文发布于:2023-11-01 20:01:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550271.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错了   重定向   地方   htaccess   DirectoryIndex

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!