Apache不会在我的别名目录中加载我的.htaccess文件。
如果我将.htaccess文件放在我的根文件夹(D:/ Development)和项目文件夹(D:/ Development / code / project)中,
http://localhost/filename.html
将我重定向到stackoverflow。
http://localhost/project/filename.html
返回未找到404。
我在Windows 7 64位上运行xampp。
为什么我不能在我的子目录中使用我的.htaccess?
的httpd.conf:
<Directory />
Options +FollowSymLinks
AllowOverride All
Order allow,deny
Deny from all
</Directory>
<Directory "D:/Development">
Options +Indexes +FollowSymLinks +Includes +ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
的httpd-vhosts.conf:
Alias /project "D:/Development/code/project/"
<Directory "D:/Development/code/project/">
Options +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
</Directory>
.htaccess(重定向用于测试):
redirect 301 /filename.html http://stackoverflow.com
AddDefaultCharset utf-8
RewriteEngine ON
RewriteRule ^(stylesheet|images|favicon) - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ /index.php [NC,L]
答案 0 :(得分:1)
因为您只重定向文件/filename.html
用
redirect 301 filename.html http://stackoverflow.com