I recently changed my CMS, and want to rewrite some of my URLs to match the new URL/query string parameter format.

The old URL was:

http://www.mysite.com/search.cgi?tag=foo&blog_id=bar&other=baz

The new URL should be:

http://www.mysite.com/?s=foo

In other words, there were several query string parameters in the old format, but I only care to rewrite the tag param to s while keeping the same value. The other parameters should be discarded. Of course the order of the parameters shouldn't matter. It also shouldn't matter whether tag is the only parameter or not.

Any ideas?

Accepted Answer

Written by
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki