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 main-domain.com in cpanel. Now you want to host another site, named another-domain.com, 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. another-domain.main-domain.com). Now both the newly added domain (another-domain.com) and the subdomain (another-domain.main-domain.com) will actually point to another-domain.com; thus the web site content is accessible from both the addresses and there are plenty of reasons why you want to stop the subdomain (another-domain.main-domain.com) access.
To solve this problem we need to add the lines below to .htaccess in the another-domain.com directory and change the URL to your addon domain URL.
RewriteEngine On RewriteCond %{HTTP_HOST} !another-domain.com RewriteRule ^(.*)$ http://another-domain.com [R=301,L]
This should work on all shared hosting providers that use cPanel.