Forum Moderators: phranque

Message Too Old, No Replies

One site, two domains -- how should that be setup?

         

Linda_A

10:54 am on Sep 13, 2007 (gmt 0)

10+ Year Member



I am wondering how one should setup things to have two domains pointing to the same site? I want to avoid any issues with Google that could come from having it treated as two separate sites with exactly the same content; I just want to use the second domain that I have bought as an alias for the first one.

jdMorgan

2:59 pm on Sep 13, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Generally, you want to 301-Moved Permanently redirect all requests to the "secondary" domain (and all non-canonical variants of the main domain as well) to the same "page" in the canonical domain. You should do the same for any other "alias" URLs, too, such as example.com/ and example.com/index.html.

Jim

Linda_A

3:13 pm on Sep 13, 2007 (gmt 0)

10+ Year Member



Okay, thanks. :) Wouldn't it be possible to have a single redirect that covers anything that goes to www.example.com/example.com?

Is it best to have ones host set this up or to just use a .htaccess?

jdMorgan

12:00 am on Sep 14, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



One rule can redirect all request from one domain to the same page on the other.

Another rule is required to redirect index.html to "/".

Whether you want to ask your host to do this depends on your confidence in their support, your preference for doing things yourself, and how much time you're willing to invest in learning some of the more technical aspects of running a site in order to give yourself maximum control and flexibility in the future.

I should note that the code for both of these functions is fairly simple, has been posted here many times, and is available to cut-n-paste after gaining a bit of 'comfort' with how it works... :)

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim