Htaccess RewriteRule - Url with Arguments
by Rekha[ Edit ] 2009-10-24 11:03:18
1)If you want to replace:
http://www.xxx.com/index.php?id=1200
with:
http://www.xxx.com/common.php?id=1200
you can use [QSA] (Query String Append)
RewriteEngine On
RewriteRule ^index.php$ http://xxx.com/common.php [R=301,QSA,L]
2)If you want only to redirect for a specific value, you would do this
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(1200)$
RewriteRule ^index.php$ http://xxx.com/common.php?%1 [R=301,L]
3) If you want only to redirect one of a set of values (red or blue, split by a pipe) you could do this
RewriteEngine On
RewriteCond %{QUERY_STRING} ^(1200|1211)$
RewriteRule ^index.php$ http://xxx.com/common.php?%1 [R=301,L]