Reputation: 537
How using mod_rewrite could i manipulate the query string variable?
e.g. i want the following 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?
Upvotes: 0
Views: 296
Reputation: 1106
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]
Upvotes: 3