Php htaccess忽略目录及其子目录
我的htaccess文件中包含以下内容:Php htaccess忽略目录及其子目录,php,.htaccess,Php,.htaccess,我的htaccess文件中包含以下内容: <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(mailinglist)/.*$ - [L] RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] </IfModule> 重新启动发动机
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(mailinglist)/.*$ - [L]
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
重新启动发动机
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^(邮件列表)/.*$-[L]
重写规则^(.*)$index.php?url=$1[QSA,L]
如果我在mailinglist目录中,我基本上希望删除htaccess以避免命中最后一行
这仅适用于/mailinglist目录根目录中的项目。一旦我深入到/mailinglist/w/1,它就会打破并达到最后的重写规则。如果我在/mailinglist目录中,如何阻止它处理最后的重写规则
原因是我在该目录中有一组不同的htaccess,我不想让这个htaccess控制它。试试:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^(mailinglist)/.*$
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
重新启动发动机
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_URI}^(邮件列表)/*$
重写规则^(.*)$index.php?url=$1[QSA,L]
我刚刚将检查
邮件列表的功能切换为重写秒。如果URI不是以mailinglist
开头,则条件将仅重写为index.php。如果条件应用于错误的规则,则需要交换规则:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(mailinglist)/.*$ - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [QSA,L]
</IfModule>
重新启动发动机
重写规则^(邮件列表)/.*$-[L]
重写cond%{REQUEST_FILENAME}-D
重写cond%{REQUEST_FILENAME}-F
重写规则^(.*)$index.php?url=$1[QSA,L]
条件仅适用于紧跟其后的规则,因此2-f
和-d
条件被误用到传递中,而index.php
规则缺少这些条件。多亏了Jon和Drew!现在的问题是,当我进入mailinglist目录的2个子目录时,这个条件不再适用。我还在HTACCESS上学习正则表达式,不知道要添加什么才能使它识别许多子目录http://www.example.com/mailinglist/w/1
然后点击“重写”规则。如果它位于mailinglist目录中,如何防止它达到重写规则?