How to remove subdomain from google search and redirect to main domain?

How to remove subdomain from google search and redirect to main domain?

subdomain indexing

A domain is simply a part or section of the internet that shares a common suffix or is under the control of the same organisation or individual. A subdomain is a domain which is a part of another domain. Many hosting accounts often allow hosting of multiple sites from the same hosting account. One may add multiple domains to the same main website or domain as the Addon domain from the cPanel. This makes hosting of multiple domains from one single hosting account possible.

However, the problem with this approach is that with every Addon domain created from the cPanel a subdomain is formed automatically. The subdomain this created is joined with the Addon domain and the Addon domain is unable to work without it. This may be the cause of some problems.

When this happens Google fails to recognise them as a part of the same blog and the creator is penalized for having duplicate content. To avoid such complications one must redirect the original subdomain to the Addon domain. Doing so you can avoid plagiarism of contents and also help in optimisation of search engines. Now the question arises How do you remove your subdomain from google search and redirect to main domain?

For that all we need to add the lines below to .htaccess. This way when a search engine reaches our subdomain, it will understand it has been permanently moved to the Addon domain.

RewriteEngine On
RewriteCond %{HTTP_HOST} !your-domain.com
RewriteRule ^(.*)$ http://your-domain.com [R=301,L]

This should work on all shared hosting providers that use cPanel. 

Amit H

Posted by Amit H

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.

 Comments

Leave a Comment

Your email address will not be published. Required fields are marked *

DOWNLOAD YOUR FREE EBOOK

STEP BY STEP WORDPRESS SETUP GUIDE 2019
Your Information will never be shared with any third party