Htaccess for addon domains
By Ashley • Apr 13th, 2008 • Category: SEOFor those of you that make use of add-on domains on your hosting accoumt, its important to setup an .htaccess file to redirect any visitors or bots who find their way to one of the subdomains., to aviod duplicate content issues.
There are three (well six actually!) ways of accessing an add-on domain:
Root domain name (ie. www.addondomain.co.uk)
Subdomain (ie. www.addondomain.the-hosting-domain.co.uk)
Subfolder (ie. www.the-hosting-domain.co.uk/addondomain)
Then of course you have the same three again without the www.
So in order to avoid duplicate sites being spidered and indexed, we can use a few command in the .htaccess file so that all possible names resolve at www.addondomain.co.uk.
Here is what you need to put in you htaccess file in the directory that houses your add-on domain ie. www.the-hosting-domain.co.uk/add-on/ :
Code:
Options +FollowSymlinks
RewriteEngine OnRewriteCond %{HTTP_HOST} ^addondomain\.co.uk [NC]
RewriteRule ^(.*) http://www.addondomain.co.uk/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^www.addondomain.the-hosting-domain\.co.uk
RewriteRule ^(.*)$ http://www.addondomain.co.uk/$1 [R=permanent,L]
RewriteCond %{HTTP_HOST} ^addondomain.the-hosting-domain\.co.uk
RewriteRule ^(.*)$ http://www.addondomain.co.uk/$1 [R=permanent,L]
And add this to the .htaccess file in the root domain: ie. www.thehostingdomain.co.uk
Code:
Options +FollowSymlinks
RewriteEngine OnRedirect /addondomain http://www.addondomain.co.uk
That should work!
Please note in my example:
addondomain = Rootdomain name
the-hosting-domain = The domain name that hosts your add-on domain.
Feel free to ask any questions.
[...] Re: Addon domains - ok for seo? There can be problems with duplicate content if you dont set it up right. More info here: Rankwell ? Blog Archive ? Htaccess for addon domains [...]