Set Document Root outside public_html for Addon Domain OR Sub Domain
Every website needs a folder to store its files, and this folder is called the Document Root. On most cPanel servers, the system forces you to keep all your addon domains and subdomains inside the main public_html folder.
What is Document Root Restriction
Document root restriction is a security setting in WHM that limits where a user can place their website files. It keeps everything organized in one spot, but sometimes you might need more freedom to manage your file structure.
Why Change the Document Root Location
You might want to host a website in a separate folder for better organization or privacy. Setting the folder outside public_html prevents the main domain from accessing the files of the addon domain.
Steps to Disable the Restriction
- Log in to your WHM panel using your root administrator account.
- Find the Server Configuration section on the main dashboard.
- Click on the Tweak Settings option to open the configuration list.
- Locate the search box on the right side of the screen.
- Type the word public_html into this search box to find the setting.
- Look for the option named Restrict document roots to public_html.
- Change the setting from On to Off to remove the limitation.
- Scroll to the bottom of the page and click the Save button.
Creating the Addon Domain
Once you change this setting, you can choose any path for your new websites. The system will no longer give you an error when you type a custom folder path.
How to Use the New Path
- Open the cPanel account where you want to add the domain.
- Go to the Domains or Addon Domains section.
- Enter the new domain name in the required field.
- Find the Document Root input box in the form.
- Backpsace the default path and type your own folder name.
- Ensure the path starts from the home directory of the user.
- Click the Add Domain button to finish the setup.
Cantech Hosting Solutions
Cantech includes this flexible feature in all our plans by default. You do not need to ask for special permissions to organize your folders. Our VPS and Dedicated server clients get full root access to manage these settings themselves. We provide a very stable environment, so your custom file paths always work seamlessly.
Conclusion
You get total control over your server file system by changing the document root. It is a simple process in the WHM settings that gives better privacy for your secondary domains. You must remember the folder paths you create for your future maintenance tasks.
FAQs
Is it safe to turn off this restriction?
Yes, it is safe if you are the only person managing the accounts. It allows you to separate the files of different websites more effectively. You just need to be careful about setting the correct file permissions for these new folders.
Can I move an existing website outside public_html?
You can move the files of an existing site to a new folder outside public_html. However, you must update the document root path in the server configuration files afterward. This ensures the web server knows where to find the website data.
Does this change affect the main domain?
No the main domain will still use the public_html folder for its files. This setting only affects how you create new subdomains or addon domains. Your primary website will continue to function exactly as it did before.
What happens if I turn this setting back to On?
The existing domains with custom paths will continue to work normally. However, you will not be able to create any new domains outside the public_html folder. The system will force the default path for all future additions.