[英]Ignoring .htaccess files and rules in one subdirectory via Apache .conf file
我试图让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
部分。
我建议更新为:
<Directory "/home/user/test_domain_com/www">
AllowOverride All
</Directory>
<Directory "/home/user/test_domain_com/www/test">
AllowOverride None
</Directory>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.