从mo重写中排除get参数

时间:2015-01-22 16:12:51

标签: .htaccess mod-rewrite rewrite

http://site.ru/?pages=(。*?)

如何从mod_rewrite

中排除它

我试过这样的事情

AddDefaultCharset UTF-8
RewriteEngine on
RewriteCond %{REQUEST_URI}  !(images|\?pages=.*?) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?%{QUERY_STRING} [L]

#<IfModule mod_security.c>
#SecFilterEngine Off
#SecFilterScanPOST Off
#</IfModule>
#<IfModule security_module>
#SecFilterEngine Off
#SecFilterScanPOST Off
#</IfModule>
#<IfModule security2_module>
#SecFilterEngine Off
#SecFilterScanPOST Off
#</IfModule>

1 个答案:

答案 0 :(得分:0)

您可以使用:

RewriteEngine on

RewriteCond %{REQUEST_URI}   !/images [NC]
RewriteCond %{QUERY_STRING}  !(^|&)pages= [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ index.php [L]

即。使用RewriteCond %{QUERY_STRING}匹配查询参数。