Mod rewrite 关闭子目录的mod_rewrite

Mod rewrite 关闭子目录的mod_rewrite,mod-rewrite,Mod Rewrite,在httpd.conf中,我在webroot中有一个重写规则 首先,我关闭子目录中的mod_rewrite <directory /home/xxxx/public_html/subdir> RewriteEngine off </directory> 发动机熄火 然后在需要的地方打开 <directory /home/xxxx/public_html> RewriteEngine On # bunch of rewrite rules &l

在httpd.conf中,我在webroot中有一个重写规则

首先,我关闭子目录中的mod_rewrite

<directory /home/xxxx/public_html/subdir>
  RewriteEngine off
</directory>

发动机熄火
然后在需要的地方打开

<directory /home/xxxx/public_html>
  RewriteEngine On
  # bunch of rewrite rules
</directory>

重新启动发动机
#一堆重写规则
但“重写引擎”在子目录中保持打开状态。我已经用RewriteLog3完成了日志记录,并看到它在subdir中处理文件

我已经尝试将subdir移动到httpd.conf的maindirectory部分下面,但它仍然处理subdir文件

我知道我可以在我的主规则中匹配并排除subdir,但是为了提高速度,我试图避免处理该目录


你知道为什么或者如何关闭子目录的mod_rewrite吗?

如果根目录的mod_rewrite处于打开状态,则始终会测试其中的规则,即使它们干扰子目录中的正常URL。最好将规则移动到vhost级别,为subdir添加某种类型的排除,然后关闭allowoverride。这意味着这些规则保留在内存中,服务器不查找和重新解析htaccess文件,从而提高了性能。如果根目录打开,则始终会测试其中的规则,即使这些规则干扰了子目录中的正常URL。最好将规则移动到vhost级别,为subdir添加某种类型的排除,然后关闭allowoverride。这意味着规则保留在内存中,服务器不查找和重新解析htaccess文件,从而提高了性能。