If you have Addon Domains in cPanel, they can technically be accessed by your primary domain name due to the directory structure of cPanel as show below:
addon-domain1.com – /public_html/addon-domain1 addon-domain2.com – /public_html/addon-domain2 addon-domain3.com – /public_html/addon-domain3
This can be solved by adding the code shown below to your .htaccess file. This will prevent your addon domains being access through your main domain. By adding the code below, your visitors will see a 404 error instead of the addon domain name.
RewriteEngine On RewriteCond %{HTTP_HOST} ^(www.)?maindomain.com$ [NC] RewriteCond %{REQUEST_URI} ^/addon-domain1/(.*)$ [OR] RewriteCond %{REQUEST_URI} ^/addon-domain2/(.*)$ [OR] RewriteCond %{REQUEST_URI} ^/addon-domain3/(.*)$ RewriteRule ^(.*)$ - [L,R=404]