Forum Moderators: phranque

Message Too Old, No Replies

Redirecting secondary domain

Two domains point to the same account on webserver - duplicate problem

         

man in poland

9:18 am on May 6, 2008 (gmt 0)

10+ Year Member



Hi. I have just taken over a website which has the following problem - it is actually 2 websites! Let's call the main site example.com. The previous webmaster was smart enough to buy example.org as well, but this is pointed to exactly the same directory as the main site - great for users but horrid for search engines.

ie: example.org/hello.php shows exactly the same content as example.com/hello.php - and Google has some pages indexed and ranking under the one domain, and others under the other domain.

The server setup is Apache / Cpanel - so in the control panel I can see the two parked domains pointing to the same folder.

Mod rewrite is enabled

I am sure there should be some way in the domain root htaccess file that I can 301 redirect all the pages on example.org to the same page on example.com.

I would probably be able to work some way around this by setting up a new server account, changing the nameservers of example.org to point to this new account, and there add an htaccess file to do the redirect to example.com, but if someone knows a simple way to do this using the current setup I have, that would be very welcome...

jdMorgan

1:20 pm on May 6, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The method described in this recent thread [webmasterworld.com] can be modified to suit your needs by changing the rule pattern to redirect all URL-paths.

Also, a WebmasterWorld search on "canonical domain rewriterule" and "canonicalize domain rewriterule" will bring up hundreds of threads on this subject.

Jim

man in poland

6:43 pm on May 7, 2008 (gmt 0)

10+ Year Member



Thanks a lot! I managed to get it working, and checked with a server headers tool to make sure it was sending the correct 301 return.

g1smd

7:18 pm on May 7, 2008 (gmt 0)

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



Make sure you check for both www and non-www for both domains.