Forum Moderators: phranque

Message Too Old, No Replies

htaccess redirection with query string

         

federrer

5:19 am on Apr 24, 2009 (gmt 0)

10+ Year Member



I am trying to redirect some of my product pages from the old site to the new site.. this is what i want...

www.mysite.com?id=10 needs to be redirected to www.newsite.com?id=10

how can i do this using htaccess... help me please

federrer

5:27 am on Apr 24, 2009 (gmt 0)

10+ Year Member



and i want to do this too...
[mysite.com?id=10...] needs to be redirected to [newsite.com?f=12&ft=9&page=2...]

g1smd

2:48 pm on Apr 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The first one is easy, because the path part and query string part are similar or identical on both sites. Query strings are automatically re-appended by RewriteRule unless you explicitly say to not do so in the code.

The second cannot be solved with .htaccess alone because there is no way for .htaccess to know that

?id=10
and
?f=12&ft=9&page=2
are related. You will need some sort of database lookup script to do that.

However there is a much more fundamental problem with your question. Are you saying you have two sites? One at www and one at non-www? Check your example URLs, and confirm they are all correct.