我有以下.htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([^>]+)/([^>]+)/([^>]+)/([0-9]+)$ index.php?region=$1&city=$2&course=$3&page=$4
RewriteRule ^([^>]+)/([^>]+)/([^>]+)$ index.php?region=$1&city=$2&course=$3
RewriteRule ^([0-9]+)$ index.php?page=$1
如果我访问
templates/firstTemplate/css/style.css
它重定向到index.php,所以我的style.css没有应用,如何禁用此特定网址的网址重定向?
答案 0 :(得分:2)
条件仅适用于紧随其后的规则,这意味着您的第二和第三条规则没有任何所需条件。您需要为其他两条规则重复这些规则:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([^>]+)/([^>]+)/([^>]+)/([0-9]+)$ index.php?region=$1&city=$2&course=$3&page=$4
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([^>]+)/([^>]+)/([^>]+)$ index.php?region=$1&city=$2&course=$3
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([0-9]+)$ index.php?page=$1