我创建了 .htaccess 文件:
RewriteRule ^([a-zA-Z]{0,2})/(.*)/(.*)$ index.php?lang=$1&ctrl=$2&method=$3 [L]
RewriteRule ^([a-zA-Z]{0,2})/(.*)$ index.php?lang=$1&ctrl=$2 [L]
RewriteRule ^(.*)/(.*)$ index.php?ctrl=$1&method=$2 [L]
RewriteCond %{QUERY_STRING} !ctrl
RewriteRule ^(.*)/?$ index.php?ctrl=$1 [L]
我需要它来忽略重写包含的 css 文件。
谢谢你的回答:)
最佳答案
保持你的规则是这样的:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([a-zA-Z]{0,2})/([^/]+)/([^/]+)/?$ index.php?lang=$1&ctrl=$2&method=$3 [L,QSA]
RewriteRule ^([a-zA-Z]{0,2})/(.*)$ index.php?lang=$1&ctrl=$2 [L,QSA]
RewriteRule ^([^/]+)/([^/]+)/?$ index.php?ctrl=$1&method=$2 [L,QSA]
RewriteCond %{QUERY_STRING} !ctrl
RewriteRule ^([^/]+)/?$ index.php?ctrl=$1 [L,QSA]
关于css - 如何忽略使用 .htaccess 重写 css 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25081752/