我有这个别名配置:
Alias /test/ "D:/WWW/Test/"
<Directory "D:/WWW/Test/">
Order allow,deny
Allow from all
</Directory>
然后在D:/WWW/Test/
目录中,我使用以下配置放置.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^([^.]*'.css)$ resources/$1 [L,NC]
</IfModule>
我只想将所有请求从localhost/test/css/*
重定向到localhost/test/resources/css/*
。
但似乎忽略了.htaccess
。即使我放了DirectoryIndex blablabla.php
,浏览器仍然显示index.html.
如何解决这个问题?非常感谢。
您需要三样东西:
- 在
<Directory>
中,允许使用AllowOverride All
访问.htaccess文件 - 使用
Options FollowSymLinks
授予mod_rewrite所需的权限 - 在.htaccess中,包括
RewriteBase /test/