Addon Domain Redirection

October 30, 2008 · Filed Under SEO 

I recently created couple of Addon Domains on my newly hosted account. Right after I added them from the cPanel I realized anyone can access them in a few different ways. As you know Addon domain works similar to your subdomains, so you can access them exactly the same way you can access your subdomains. The main difference between Addon domain and sub domain is that Addon domain works independently like any other domain.

Anyway, so I realized that these are the few ways my site visitors can access my Addon domains:

  1. http://www.addondomain.maindomain.com/
  2. http://www.maindomain.com/addondomain/
  3. http://www.addondomain.com/

And of course again the same URLs without the WWW. Now, this wasn’t good enough for me. Why? Because having many different copies of the same content is telling Google that you’ve got duplicate content. Because to Google bot all these different URLs display their own copy of the content. So I wanted to point all these different doorways to one central location to avoid the duplicate copy confusion. And that’s where the challenge began. Though in the end it looked quite simple but I had to do a bit of research and a lot of trial & error before finally achieving what I wanted.

Anyway, here’s what you need to do if you want to achieve the same result. I suggest you SHOULD do it if you have Addon domains.

Note: Before doing anything, please take a backup of your existing .htaccess files so that you can quickly restore the changes if you have any issues. Also make sure to keep existing code in the .htaccess file specially if you’re running Wordpress blog and you’ve setup custom permalink structure.

Now, you’ve to modify each instance of the .htaccess file. One for your main domain which is under /public_html and the other for your Addon domain which is under your /addondomain folder.

Here’s the code of your main domain’s .htaccess file:

Redirect 301 /addondomain http://www.addondomain.com
RewriteEngine on

RewriteCond %{HTTP_HOST} ^addondomain.maindomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.addondomain.maindomain.com$

RewriteCond %{HTTP_HOST} ^maindomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.maindomain.com$
RewriteRule ^sitelinkedin/?$ “http\:\/\/www\.addondomain\.com\/” [R=301,L]

And here’s the code for your Addon domain’s .htaccess file:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^addondomain.com$
RewriteRule ^/?(.*)$ “http\:\/\/www\.addondomain\.com\/$1″ [R=301,L]

RewriteCond %{HTTP_HOST} ^addondomain.maindomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.addondomain.maindomain.com$
RewriteRule ^/?$ “http\:\/\/www\.addondomain\.com\/” [R=301,L]

That’s it. Easy, wasn’t it? Remember, this will also take care of your non WWW issue for both of your sites. I am really fussy about it and I think you should be too. Again, to Google non WWW and WWW are two different URLs. You may take good care when set up your sites but other people may not when they link to your site. So having a standard rule will help you in the long run.

Did you like this post? Then please consider subscribing!

Comments

4 Responses to “Addon Domain Redirection”

  1. How to Redirect an Addon Domain « Techreview Australia on October 31st, 2008 12:35 am

    [...] …this procedure shows you how to setup Addon domain redirections using .htaccess file. Continue Reading ยป [...]

  2. Josh on February 26th, 2009 4:36 pm

    You need to leave the quotation marks out or else you’ll get 403 errors. Thanks though, worked like a charm after I did that. very nice.

  3. Mayra on April 12th, 2009 5:16 am

    Hi, thank you for this helpful post!

    I not only hope you still read older post comments, but I hope you have a moment for a quick question.

    I added the code to the htaccess files as you specified and now the addondomain.maindomain.com comes up as “Forbidden” rather than redirecting.

    I am mainly wondering if this will still cause dup content issues? If the address is no longer able to pull up a copy of my site under the weird URL then I would think the issue would be resolved but I am hoping to get some clarification on this.

    Thanks for your time!

  4. Mayra on April 12th, 2009 5:20 am

    Oh, forgot to add to the above. While the addondomain.maindomain.com does not pull up, I can access the add on by going to maindomain.com/addondomain. The thing I am concerned with here, is that it doesn’t redirect straight to the add on url but it looks like addondomain.com/?ID=addondomain

Leave a Reply




Web Design, Web Development, SEO, Online Marketing Australia © 2008 Kantush.com · All Rights Reserved · Revolution Blog theme by Brian Gardner · Shares · Web Design & Development