In Cpanel, it is possible to access a URL using the primary domain and an addon domain as a subfolder or a subdomain just like below.
- http://2nddomain.com
- http://2nddomain.your1stdomain.com
- http://your1stdomain.com/2nddomain.tld/
- https://2nddomain.tld
- https://2nddomain.your1stdomain.com
- https://your1stdomain.com/2nddomain.tld/
To prevent a URL to be accessible from the primary domain, here is the procedure to follow
- Backup the website content (public_html folder) of your primary domain
- Disable the
autoSSL feature for the primary domain in Cpanel. - Replace the primary domain with a dummy domain name. You must have access to the nameserver settings of this domain name. Ask you Cpanel admin or if you have access to WHM follow this procedure.
- Add your former primary domain name as an addon domain and map the folder to the existing folder where the content of your primary domain was stored.
- Change the nameservers of your former primary domain and make it point to something else than your web server.
Now you will get the following and it is good.
- http://2nddomain.com
- http://2nddomain.your1stdomain.com => not accessible
- http://your1stdomain.com/2nddomain.tld/ => not accessible
- https://2nddomain.tld
- https://2nddomain.your1stdomain.com => not accessible
- https://your1stdomain.com/2nddomain.tld/ => not accessible