Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache 如果放入子目录,则htaccess不工作_Apache_.htaccess - Fatal编程技术网

Apache 如果放入子目录,则htaccess不工作

Apache 如果放入子目录,则htaccess不工作,apache,.htaccess,Apache,.htaccess,Apache不会在我的别名目录中加载我的.htaccess文件 如果我将.htaccess文件放在根文件夹(D:/Development)和项目文件夹(D:/Development/code/project)中 http://localhost/filename.html 将我重定向到stackoverflow http://localhost/project/filename.html 返回找不到404 我在Windows7 64位上运行xampp 为什么我不能在我的子目录中使用.htacce

Apache不会在我的别名目录中加载我的.htaccess文件

如果我将.htaccess文件放在根文件夹(D:/Development)和项目文件夹(D:/Development/code/project)中

http://localhost/filename.html
将我重定向到stackoverflow

http://localhost/project/filename.html
返回找不到404

我在Windows7 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>

因为您只对文件/filename.html进行了重定向
将代码的第一行替换为

redirect 301 filename.html http://stackoverflow.com

index.php
文件是在文档根目录中还是在
project
目录中?index.php在我的project目录中。但问题是,my.htaccess没有加载到my/project目录中
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]
redirect 301 filename.html http://stackoverflow.com