使用.htaccess不重写具有特定GET参数的URL

时间:2012-10-24 19:13:39

标签: .htaccess url-rewriting seo

以下部分写入我的.htaccess文件。我正在使用ZenCart“CEON URI Mapping”模块。我遇到了问题,因为有一部分PHP脚本会查找某个变量并在找到时显示一个CSS显示框。

我需要做的是让htaccess在设置时不用“amznPmtsOrderIds”GET参数重写URL。

我如何将其纳入以下内容:

# BEGIN CEON URI MAPPING
# Don't rewrite any URIs ending with a file extension (ending with .[xxxxx])
RewriteCond %{REQUEST_URI} !\.[a-z]{2,5}$ [NC]
# Don't rewrite admin directory
RewriteCond %{REQUEST_URI} !^/admin [NC]
# Don't rewrite editors directory
RewriteCond %{REQUEST_URI} !^/editors [NC]
# Don't rewrite cPanel directories
RewriteCond %{REQUEST_URI} !/cpanel [NC]
RewriteCond %{REQUEST_URI} !/frontend [NC]
RewriteCond %{REQUEST_URI} !\.mp4$ [NC]
RewriteCond %{REQUEST_URI} !/livehelp.*$ [NC]
RewriteCond %{REQUEST_URI} !/rest.php/
RewriteCond %{REQUEST_URI} !/restInterface\.php.*$
# Handle all other URIs using Zen Cart (index.php)
RewriteRule .* index.php?%{QUERY_STRING} [L]
# END CEON URI MAPPING

感谢您的帮助。

1 个答案:

答案 0 :(得分:1)

紧接在此行之前...

# Handle all other URIs using Zen Cart (index.php)

...添加:

# Don't rewrite any URIs with a "amznPmtsOrderIds" GET parameter
RewriteCond %{QUERY_STRING} !amznPmtsOrderIds [NC]