Web Hosting Talk







View Full Version : Redirecting one domain to another


GeorgeC
12-15-2001, 02:44 AM
I was wondering, what is the best way to redirect one domain to another? I have two domains that both point to the same site, though I wish one of them to be the default used.

Is this something that's done by editting the .htaccess file, or DNS itself?

slade
12-15-2001, 05:00 AM
Hope I understood this...

SiteA.com exists.
SiteB.com is pointed at SiteA.com

You want a user who types in www.siteb.com to be redirected to www.sitea.com, before they see a page.

RewriteEngine On
RewriteCond %{HTTP_HOST} www.siteb.com [NC]
RewriteRule ^$ http://www.google.com/$1 [R]
At 3am, this is as close as i could get... but it only works for www.siteb.com, not www.siteb.com/anything :(

GeorgeC
12-15-2001, 05:28 AM
Thanks slade. Your description of what I need is very close, though I need the solution to work with both www. and without seamlessly, so for example, typing:


siteb.com -> sitea.com
www.siteb.com-> www.sitea.com


Thanks for any further help.

Editted question

jahsh
12-17-2001, 08:58 PM
add both of the following:
ServerAlias www.sitea.com www.siteb.com siteb.com
and also what was mentioned above and that should do it, oh yeah restart apache server as well.