How using mod_rewrite could i manipulate the query string variable?
e.g. i want the f开发者_C百科ollowing query string:
?route=product/product&product_id=158?ax13g76h
rewritten to:
?route=product/product&product_id=158
Basically i only want to keep everything between the 2 question marks. As soon as the second question mark is hit everything after is removed
Is this possible?
For this case you can use this:
RewriteCond %{QUERY_STRING} route=product/product&product_id=(\d+).*
RewriteRule (.*) $1?route=product/product&product_id=%1
And for all other
RewriteCond %{QUERY_STRING} (.+)\?.*
RewriteRule (.*) /$1?%1 [L,R=301]
精彩评论