你好在我的htaccesss文件中我把这段代码确保我的目录索引文件设置为
v2013 / index.html中
所以我把这段代码
DirectoryIndex v2013/index.html
然后我希望它看起来像mydomain.com/Welcome,所以我添加..
RewriteEngine On
RewriteRule ^Welcome$ v2013/index.html [L]
我的问题是为什么DirectoryIndex不再工作..我怎么能告诉浏览器在v2013中查找css,因为它是在root中查找。 (我认为是因为重写)所以我的页面是不稳定的.. =(
换句话说,正在寻找
的www.domain.com/css/sheet.csswww.domain.com/v2013/css/sheet.css
答案在这里:
最终法典
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]
答案 0 :(得分:1)
您可以添加其他RewriteRule
,以重写css/
,js/
和images/
文件
# exclude files already asking for v2013
RewriteCond %{REQUEST_URI} !^/v2013/
RewriteRule ^(?:css|images|js)/.*$ /v2013/$0
答案 1 :(得分:0)
如果使用css文件,请不要键入“css / style.css”,请写“/css/style.css”。添加/将您带到根目录。 html应如下所示:
<link href="/v2013/css/style.css" rel"stylesheet" type="text/css" />