Why is a subdomain created when I add an addon domain?

Due to the way in which cPanel has been designed, creating an addon domain also requires a corresponding subdomain to be created. There is no way to avoid the creation of a subdomain, but you can hide URLs if desired (subdomain.mydoman.com and mydomain.com/subdomain).

To do so, you can choose to redirect both links to a Not Found page, using .htaccess rule. Read more about creating .htaccess rules in this HostPapa knowledge base article: How to use .htaccess rewrite rules

Enter the following rules in the .htaccess file stored in your addon domain’s web root directory:

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

Be sure to update the rules to correspond with your own domain name and addon.

Alternatively, you can point subdomain.mydomain.com and www.subdomain.maindomain.com to a non-working IP address. For example,

Log in to cPanel and select Domains > Zone Editor.

Zone Editor

Click Manage to list the DNS zones associated with your account.

Manage button

Scroll down the list of records and click the Edit button next to the subdomain you wish to hide.

Edit button

Update the IP address and click the Save Record button to complete configuration.

If you notice any problems or if you need any help, please open a new support ticket from your HostPapa Dashboard. More details on how to open a support ticket can be found here.

Was this article helpful?

Related Articles

Leave A Comment?