Skip to content

Subdomain Fix For Addon Domains In cPanel

Most of the shared web hosts that allow hosting of multiple sites from a single hosting account like Hawkhost has a common structure. You’ll have one main website or domain and all the other websites or domains will be added as Addon domains from cpanel. This way you can host multiple websites from a single hosting account. However, this approach has a problem. With each Addon domain created from cpanel, you also automatically get a subdomain. The Addon domain is joined together with the subdomain, and doesn’t work without it.

For example, you have registered your account with the main site named in cpanel. Now you want to host another site, named, from the same hosting account. This can only be done using the Addon domain option if you are using cpanel. When you add this new domain with the Addon domain option, they will automatically create a subdomain of the main site (e.g. Now both the newly added domain ( and the subdomain ( will actually point to; thus the web site content is accessible from both the addresses and there are plenty of reasons why you want to stop the subdomain ( access.

To solve this problem we need to add the lines below to .htaccess in the directory and change the URL to your addon domain URL.

RewriteEngine On
RewriteCond %{HTTP_HOST} !
RewriteRule ^(.*)$ [R=301,L]

This should work on all shared hosting providers that use cPanel.