Preventing subdomain indexing in cPanel

How to disable indexing for subdomains automatically created when adding addon domains.

When you add an addon domain in cPanel (e.g., newdomain.com), the system automatically generates a technical subdomain such as newdomain.maindomain.com. While cPanel does not allow you to delete this internal subdomain, you can effectively prevent search engines from indexing it.

The most reliable way to stop search engines from crawling your site via this technical address is to configure a permanent (301) redirect to your primary domain.

Solution: configuring a 301 redirect via .htaccess

  1. Log in to cPanel and open the File Manager.
  2. Navigate to the document root directory of your addon domain (usually public_html/newdomain.com or the specific path set during creation).
  3. Locate or create the .htaccess file.
  4. Insert the following code block at the top of the file:
RewriteEngine On
RewriteBase /

# Block indexing for the technical subdomain by redirecting to the primary domain
RewriteCond %{HTTP_HOST} ^newdomain\.maindomain\.com [NC]
RewriteRule ^(.*)$ [https://newdomain.com/$1](https://newdomain.com/$1) [R=301,L]
  • Customization: replace newdomain.maindomain.com and newdomain.com with your actual domain names.
  • SSL/HTTPS: it is highly recommended to use the HTTPS prefix in the redirect (as shown above) if your primary domain has an active SSL certificate.
  • Status codes: the R=301 flag indicates a permanent redirect. This signals to search engines that the content has moved for good, eventually purging the technical subdomain from search results.
  • Avoid 302: do not use a 302 redirect for this purpose, as it indicates a temporary move and will not signal search engines to remove the subdomain from their index.

Post-Configuration Steps

  • Test the redirect: clear your browser cache and visit the technical subdomain to ensure it successfully forwards you to the primary domain.
  • Google search console: if the subdomain has already been indexed, you can use the Removals tool in Google Search Console to speed up the process of hiding it from search results.
  • Multiple domains: if you have multiple addon domains, you must repeat this process by adding specific rules for each corresponding .htaccess file.

Help

If you have any questions or need assistance, please contact us through the ticket system — we're always here to help!

Need help?Our engineers will help you free of charge with any question in minutesContact us