2

我有以下 .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 没有应用,我怎样才能禁用这个特定 url 的 url 重定向?

4

1 回答 1

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
于 2013-04-11T09:50:48.777 回答