Forum Moderators: phranque

Message Too Old, No Replies

301 redirect domain1.com?query -> domain2.com?query

.htaccess to redirect requests including queries to another domain

         

knnknn

2:25 pm on Aug 4, 2005 (gmt 0)

10+ Year Member



I have 2 domains:
A aaa.com and bbb.com

I want to redirect with .htaccess all queries to aaa.com -> bbb.com

So that aaa.com?a=1 redirects permanently (301) to bbb.com?a=1

ChadSEO

4:07 pm on Aug 4, 2005 (gmt 0)

10+ Year Member



knnknn,

Something like this should do the trick for you:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?aaa\.com [NC]
RewriteRule (.*) [bbb.com...] [R=301,L]

knnknn

5:51 pm on Aug 4, 2005 (gmt 0)

10+ Year Member



Hmm, it basicaly works

BUT: Calls to "/cgi-bin/script.cgi" are not forwarded

Could it be that "cgi-bin" is already redirected so that this htaccess has a lower priority?

jdMorgan

6:45 pm on Aug 4, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, if a ScriptAlias or Alias directive for cgi-bin is present in httpd.conf, then the rules will be bypassed.

Jim