In this tutorial, I will show you how to hide the subdomain created by cPanel for addon domains.
If you have noticed, each time an addon domain is created in cPanel, the addon domain comes with a subdomain attached to it. Though there’s no way to avoid creating a subdomain when creating an addon domain, you can however hide the URL so none of your website’s visitors can tell if the website is an addon domain.
To hide the subdomain, you can use .htaccess in the File Manager to redirect the subdomain to a Not Found page, then whenever a visitor visits the addon domain, they will get a 404 Not Found error.
Let’s get started.
Hide the Subdomain Created by cPanel for Addon Domains
- Log into your cPanel.
- Go to the Files section and select File Manager.
- In the File Manager, scroll down to .htaccess. Right-click and in the pop-up option, select Edit. Then in the pop-up screen that appears, click on Edit.
- In the .htaccess file, you can enter the following rules:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} test.demo-tutorial-yt.com$
RewriteRule ^(.*)$ "https://demo-tutorial-yt.com/404" [R=301,L]
</IfModule>