By default, cPanel places the document root for addon and subdomains inside the public_html
directory. However, you can configure the document root to reside outside public_html
for better organization or security. Here’s how you can do it.
Prerequisites
- Root Access to the server’s WHM
Step 1: Log in to WHM either with the root account. Normally you will use one of the URLs below;
http://your_server_ip:2087
https://your_server_hostname:2087

- Navigate to Home /Server Configuration / Tweak Settings

- Use the search box in tweak settings to search for Restrict document then find the Restrict document roots to public_html option, and set it to Off
- Once done, click on Save.

This will make it possible for addon and subdomain document root to be created in custom locations, instead of the system forcing them to public_html