Help

Why does cPanel create a subdomain when adding an additional domain?

Adding an additional domain involves creating a corresponding subdomain. From the perspective of Apache VirtualHost records, the additional domain is parked on this subdomain.

You cannot add an additional domain without creating a subdomain; this is a fundamental architectural principle of cPanel. However, there is often a desire to make the links - addon.maindomain.com and maindomain.com/addon - inaccessible.

1. Redirect both links to a "Not Found" page using .htaccess, which should be placed in the root directory of the additional domain's website:

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

Make sure you update the names of the additional domain and the main domain accordingly.

2. Redirect the subdomains addon.maindomain.com and www.addon.maindomain.com to a non-working IP address, such as localhost (loopback address) 127.0.0.1 or simply delete these DNS records. You can do this in your cPanel account as follows:

Go to your cPanel account > "Domains" section > "Zone Editor" menu:

Have more questions about Hosting?