I recently added techofweb.com as an Add-on Domain to mine primary domain oceanofweb.com
Addon Domains can be accessed in following 3 different ways:
*www.addonDomain.com
*www.primaryDomain.com/addonDomain.com
*www.addonDomain.primaryDomain.com
You can have the same thing in following ways too:
*Without www
*With prefixing http://
*With prefixing http:// and removing www
So, it counts total of 12 different ways your add-on domain can be accessed through browser, resulting in the addition of great duplicacy for Google.
I was also facing the same problem and it ate my whole 1 day in order for the solution to come up. I mailed to my many blogging friends, contacted Hostgator customer support, googled but nowhere solution was coming. While googling, I got the following code at many places:
Options +FollowSymlinks
RewriteEngine OnRewriteCond %{HTTP_HOST} ^addondomain\.com [NC]
RewriteRule ^(.*) http://www.addondomain.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.addondomain.primarydomain\.com
RewriteRule ^(.*)$ http://www.addondomain.com/$1 [R=permanent,L]
RewriteCond %{HTTP_HOST} ^addondomain.primarydomain\.com
RewriteRule ^(.*)$ http://www.addondomain.com/$1 [R=permanent,L]
To place this code, go to your FTP/cpanel, primarydomain directory>>>addondomain directory>>> open .htaccess
And copy the above code in it.
But unfortunately, this code too didn’t work for me. 😉
So, if you too on the same floor, then try this:
Open your .htaccess file and paste the below code under mod_rewrite in it (by replacing addondomain with your domain).
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTP_HOST} !^(www.)?addondomain.com$ [NC]
RewriteCond %{HTTP_HOST} !^$ [NC]
RewriteRule ^(.*)$ http://www.addondomain.com/$1 [R=301,NC,L]
This code worked for me like a charm 🙂
So, try the above 2 codes. Atleast one will definitely work for you.
Now, access your site by the above 12 different ways.
Every time, you would be redirected to http://addondomain.com
NOTE: Please do back up your .htaccess before making any changes
Replace addondomain with your respective addondomain
18 Comments