Indexing subdomains in cPanel

How to disable indexing of subdomains (created by adding additional domains)

When adding a new domain in cPanel (for example: newdomain.com), under additional domains, automatically creates a subdomain with the login of the new domain (Subdomain username / FTP) + main domain (for example it will look like this: newdomain.maindomain.com), you cannot delete or cancel its creation.

What would prohibit indexing and browsing of the site through a subdomain, you need to do the following

In the directory of additional domain newdomain.com (this will also be the directory for your subdomain: newdomain.maindomain.com), in .htaccess add the following lines:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^newdomain.maindomain.com
RewriteRule (.*) http://newdomain.com/$1 [R=301,L]

This will perform a permanent redirect to the new domain. After a while search engines will "forget" about newdomain.maindomain.com, because getting 301 ([R=301,L]) code implies "permanent redirect".

Code 302 ([R=302,L]), indicates a temporary move and used, for example, that would redirect users from all pages (otherwise it reindexes the page when there is no information) to a certain site, which indicates that conducted temporary work on the site or in other similar cases. Then search engines will not "forget" about the existing addresses in the database.

Updated at:
8/27/2019, 09:03
Need help?Our engineers will help you free of charge with any question in minutesContact us