.htaccess !-f rule not working

前端 未结 4 1749
礼貌的吻别
礼貌的吻别 2020-12-29 10:24

I have been using simple mod_rewrite rules for my CMS for years and am now making a new version, I am seeing the rewriteCond not making sense- I have the standard \"if is no

4条回答
  •  悲哀的现实
    2020-12-29 11:18

    The RewriteConditions only apply to the next rule. You want this:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^/]+)$ index.php?page=$1
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([^/]+)/([^/]+)$ index.php?page=$1&var=$2
    

提交回复
热议问题