views:

15

answers:

1

Hi,

I'm need to redirect a a bunch of URL's through mod_rewrite. The URL structure is as follows:

www.mysite.com/somescript.php?&lang=asp&variable1&variable2

Needs to redirect to

www.mysite.com/somescript.php?&lang=php&variable1&variable2

So, basically, any URL with &lang=asp in it needs to be redirected to exactly the same URL but with &lang=php replacing &lang=asp.

Is there a way I can do this through .htaccess, perhaps with some sort of wildcard?

Thanks alot, I would appreciate your help.

Cheers,

Matt

A: 

Modifying the Query String

Change any single instance of val in the query string to other_val when accessing /path. Note that %1 and %2 are back-references to the matched part of the regular expression in the previous RewriteCond.

RewriteCond %{QUERY_STRING} ^(.*)lang=asp(.*)$
RewriteRule /path /path?%lang=php%2

Read this page for more info http://wiki.apache.org/httpd/RewriteQueryString

Samuel
Roland Illig