RewriteCond排除文件夹

时间:2016-09-03 16:33:32

标签: php .htaccess mod-rewrite

我的.htaccess中有以下内容:

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [L]

这很好用,但我不想让RewriteRule触发以下文件夹及其子文件夹。

www.site.co.uk/Content

我该怎么做?

1 个答案:

答案 0 :(得分:1)

试试这条规则,

RewriteEngine on
RewriteRule ^(content)($|/) - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?url=$1 [L]

或在内容目录中创建.htaccess并放入

RewriteEngine off