gpt4 book ai didi

php - 通过 Apache .conf 文件忽略一个子目录中的 .htaccess 文件和规则

转载 作者:行者123 更新时间:2023-12-01 12:45:55 24 4
gpt4 key购买 nike

我试图让 Apache 忽略一个子目录(及其所有后续目录)中的 .htaccess 文件和规则,但仍允许它们在父根目录中执行。看起来这行得通:

<Directory /home/user/test_domain_com/www/test>
AllowOverride None
</Directory>

但是,这里的问题是,如果根目录下有一个.htaccess文件,有一定的规则,子目录还是会受到影响。 (例如,根据任何请求调用 test.php):

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ test.php [L]

这个例子仍然影响我想忽略 .htaccess 规则的目录。是否有可能不仅忽略此目录中的 .htaccess 文件,而且还忽略可能适用于此目录的任何 .htaccess 规则?有什么我可以添加到 .conf 文件来完成这个吗?

我希望这是有道理的。

谢谢

最佳答案

来自 https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride

Only available in <Directory> sections
AllowOverride is valid only in <Directory> sections specified without regular expressions, not in <Location>, <DirectoryMatch> or

sections.

我建议更新到:

<Directory "/home/user/test_domain_com/www">
AllowOverride All
</Directory>
<Directory "/home/user/test_domain_com/www/test">
AllowOverride None
</Directory>

关于php - 通过 Apache .conf 文件忽略一个子目录中的 .htaccess 文件和规则,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35494037/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com