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

Due to how cPanel is designed, creating an addon domain also requires a corresponding subdomain to be created. There is no way to avoid creating 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 the .htaccess rule

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 ^(.*)$ "https://mydomain.com/404" [R=301,L] 

 </IfModule>

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

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

1) First, log in to your HostPapa Dashboard

dashboard

2) Click My cPanel

click-cpanel

3) Scroll to the Domains section and select Zone Editor.

zone-editor

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

manage-zone-editor

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

click-edit-button

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

save-record

If you need help with your HostPapa account, please open a support ticket from your dashboard.

Related Articles

Get online with our affordable web hosting

Get online with our affordable web hosting

Learn more now
HostPapa Mustache