Why is a subdomain create when adding a addon domain? Print

  • cpanel, addon, domain
  • 9

Whenever adding a addon domain to cPanel, a subdomain will be created automatically. The subdomain is required for the addon to work properly and should not be removed.

Unfortunately there is no option in cPanel to disable the subdomain as this is the fundamental principle of cPanel architecture, but you can hide this links.

One way is to add the following code to the .htaccess file of the addon domain's public folder.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} sub.domain.com$
RewriteRule ^(.*)$ "http://domain.com/" [R=301,L]
</IfModule>

The code will redirect all traffic from sub.domain.com to your addon domain.

Alternatively you might want to make the subdomain fully unavailable. To do so, just point the subdomain to eg. 127.0.0.1 in the DNS zone using the cPanel DNS manager/zone editor.

Please note that changes made to the DNS zone can take up to 48 hours to propagate.

Please feel free to get in touch if you have any further questions.


Was this answer helpful?

« Back