.htaccess重写规则正在丢弃我的查询字符串

时间:2011-09-21 07:37:43

标签: .htaccess mod-rewrite query-string

我的网址就像

http://172.16.3.97:82/shop/t-shirts/full-zip-sweatshirt?options=367:731,368:737,369:741&custom_inscription=test 

我写了重写规则,如

RewriteRule ^shop/t-shirts/([a-zA-Z0-9\-@]+)\?*$ shop/product?path=35&product_id=$1&test=$2

full-zip-sweatshirt中只有$_GET,但我无法获得其他参数。

我应该如何在.htaccess中编写规则?

1 个答案:

答案 0 :(得分:2)

尝试更改您的重写规则:

RewriteRule ^shop/t-shirts/([a-zA-Z0-9-@]+)\?*$ shop/product?path=35&product_id=$1&test=$2 **[L,QSA]**

标志“QSA”将原始查询字符串添加到您的查询

或许这个也应该有所帮助:

RewriteRule ^shop/t-shirts/([a-zA-Z0-9-@]+)\?*$ shop/product?path=35&product_id=$1&test=$2&%{QUERY_STRING}