How to remove addon domains from CPanel? (cloned subdomains)

16.03.2012

If you have a web hosting account that is using a main domain and one CPanel (not individual CPanels for each domains that assigned to your hosting account), when you assign a new domain to CPanel, a subdomain will also be created.

Usually, search engines like Google, Yahoo etc, do not index these subdomains but sometimes they will and there is a small risk to trigger a SEO penalty for duplicate content.

What is to be done is to get rid of these subdomains. CPanel doesn’t have any option regarding this, except the redirect. The cloned subdomains can be redirected to the main domain. The big issue is that other pages from a cloned subdomain will not make the redirrection as well.

The most simple way to solve this issue is to add these lines of code inside the .htaccess file.

RewriteCond %{HTTP_HOST} ^subdomain.mainhostdomain.com$
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

Change the settings for your .htaccess file as this: the “subdomain” is the cloned subdomain; “mainhostdomain.com” is your main domain for your web host account.

“Domain.com” is the default domain where the cloned subdomain is pointing.

You can download a .htaccess file with these lines of code from here.

By using this trick, the pages that are indexed by search engines will disappear from their index after some time and you won’t risk any SEO penalty.

htaccess file code








Leave a Reply

*
*