Redirecting two dynamic urls

Hi,

I have these this URL: http://www.website.com/subdir/?ref=1
and want to redirect it to: http://www.website.com/subdir/?ref=2

I have tried this, but it doesn’t work:


RewriteCond %{QUERY_STRING} ref=1
RewriteRule ^(.*).shtml$ http://www.website.com/subdir/?ref=2 [R=301,L]

But nothing happens. Any ideas what I have wrong?

Thanks

you want solution in .htacess or php code.

please confirm, mentioned URL’s are static or dynamic. if dynamic can you please explain little clear. because right now, as your post, when URL query string contain somthing=1 then redirect to somthing=2.

But in dynamic, how to we know, what to redirect.:cool:

ebs,

Your mod_rewrite code is:

  1. The way to go, NOT using PHP code (unless you don’t have mod_rewrite enabled on your server - that’s done in the server’s conf file).

  2. Your code will work (if not in mod_rewrite’s comment mode AND if mod_rewrite is enabled).

You didn’t say whether this was on your own (test) server or on a host’s production server. The tutorial linked in my signature will help with the former and using phpinfo() will let you know about the latter (and your host will have to assist there).

Regards,

DK