Correct way to remove Add-on Subdomain from the Searches
Here is the correct way to remove (redirect) your indexed Add-on subdomains from the search engines without harming search rankings.
When you signup for a Web hosting package, the hosting company assigns the account to the primary domain name you’ve provided while the registration process. If your hosting package supports adding multiple domains, you may point more domains to that hosting account by simply adding them as Add-on domains.
The Add-on domains are actually the subdomains to your primary domain, and they work fine with both the URLs, i.e. the subdomain one, and the add-on one. Let me clear this picture for you:
Suppose we have a primary domain example.tld
registered with our hosting account that supports add-on domains. We now want to add another domain addon.tld
to our account, and we add it as an add-on domain.
Now we have our addon domain up and running, but on two URLs:
- The Add-on domain itself; i.e
addon.tld
- The Add-on subdomain;
addon.example.tld
You need not to worry until you’ve been properly using canonical URLs on your sites. But still, there are strong chances that your add-on subdomain may get indexed on search engines. And this may also result in your sites being penalized by Google and folks for duplicate content.
Quick tip: You may quickly check add-on domain indexation for your websites by searching on Google or Bing like this: site:example.tld
Properly removing the Add-on subdomain from search results
Well, the last resort to avoid the duplicate content penalties is to remove the add-on subdomain which is the root cause of the problem. But stop! Don’t rush to Webmaster Tools to remove the URL, we can get rid of that by a simple 301 redirect.
Setting up a 301 redirect for Add-on subdomains
By a 301 redirect, we are telling the search engines that the Add-on subdomain (addon.example.tld
) is actually the Add-on domain (addon.tld
). And unlike a URL removal, a 301 redirect will also add to the search value of your Add-on domain.
In order to add a 301 redirect for your add-on subdomain, follow the below mentioned steps:
Note: The below steps are demonstrated on cPanel. If you are not using cPanel, you may just log into your hosting account via FTP or make use of the control panel as provided by the hosting service.
- Log into your hosting account cPanel, and click on the File Manager icon. This will bring a dialog as shown in the below image. In the Document root for option, select your Add-on domain, check the Show Hidden Files (dotfiles) option, and click the Go button. This will basically bring us in the Add-on domain directory.
- Now locate the
.htaccess
file, right-click it and select Edit.Click the Edit button on the next dialog, and you’ll see the .htaccess file in the edit mode.
- Finally add the following code to the .htaccess file:
<IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^addon.example.tld$ [NC] RewriteRule (.*) http://addon.tld/$1 [R=301,L] </IfModule>
If you prefer your add-on to use www
, you should rewrite the second-last line as:
RewriteRule (.*) http://www.addon.tld/$1 [R=301,L]
Be sure to replace addon.example.tld
with your add-on subdomain, and addon.tld
to your add-on domain.
Finally, check if the redirect is working fine by visiting the add-on subdomain. It should now be redirecting to the add-on domain. Now once the search bots revisit add-on subdomain and figure out the changes we’ve done, you won’t see it in the SERPs anymore.
Let me know if you’ve got stuck somewhere. Thanks :)