How using mod_rewrite could i manipulate the query string variable?

e.g. i would like the next query string:


rewritten to:


Essentially i simply want to keep everything between your 2 question marks. The moment the 2nd question mark is hit everything after is taken away

Is possible?

With this situation this can be used:

RewriteCond %{QUERY_STRING} route=product/product&product_id=(\d+).*
RewriteRule (.*) $1?route=product/product&product_id=%1

As well as for other

RewriteCond %{QUERY_STRING} (.+)\?.*
RewriteRule (.*) /$1?%1 [L,R=301]