I lately transformed my Content management systems, and wish to rewrite a number of my Web addresses to complement the brand new URL/query string parameter format.
That old URL was:
The brand new URL ought to be:
Quite simply, there have been several query string parameters within the old format, however i only choose to rewrite the tag param to s and keep exactly the same value. Another parameters ought to be thrown away. Obviously an order from the parameters should not matter. Additionally, it should not matter whether tag may be the only parameter or otherwise.
You can test to make use of regular expression and grouping, in case your server supports that. Should i be not mistaken you need to rewrite just one parameter, I suppose you could attempt something similar to (if you work with apache with mod_rewrite):
RewriteCond % ^.*(btagb=(w+&w+)+) RewriteRule ^(.+) /$1?%1 [L]
Edit: I enhanced the standard expression a bit to complement "tag" no matter its position within the query string and also to preserve special figures sequences for example
& Additionally it will avoid matches concentrating on the same parameters (i.e.: it can't match a parameter known as "alttag").
Edit #2: An alternate (especially if you need to filter several parameters) is by using an exterior program to complete the rewrite. This site: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritemap (particularly the section "Exterior spinning program") consists of helpful information.