我的.htaccess中有一些重写规则,我想添加一个异常子文件夹,以便当用户链接到该子文件夹时,mod_rewrite会停止重写 .
我的特殊子文件夹是http://simplyservices.gr/aivali当有人到达此URL时,mod_rewrite遵循规则我've added and finally user cant see aivali' s内容这是我的.htaccess
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/aivali/ [NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([^/]*)\.html$ /new1/products.php?kategory=$1 [L]
RewriteRule ^([^/]*)/([^/]*)\.html$ /new1/products.php?kategory=$1&subkategory=$2 [L]
RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /new1/products.php?kategory=$1&subkategory=$2&id=$3 [L]
我已尝试过在同一篇文章中提到的所有内容,但没有任何效果 . 我认为我的RewriteRules有些不对劲 .
谢谢
1 回答
RewriteConds仅掩盖以下RewriteRule .
因此,您的
!-f
,!-d
和!-d
检查仅适用于第一次 . 除非确实存在dir/dir/*.html
文件,否则这可能是多余的 .现在更有趣的是
RewriteCond %{REQUEST_URI} !^/aivali/ [NC]
也掩盖了第一个RewriteRule . 然而第一个RewriteRule只匹配basename.html
,从不像aivali/sub.html
你应该在第二个RewriteRule之前移动RewriteCond异常,因为那是主要捕获它的那个 .