Change Document Root in cPanel
There are two types of domains on a cPanel box that can have document roots: Main (primary) domains and Add-on domains.
Changing Primary domains
cPanel’s default primary domain’s document root is:
/home/USERNAME/public_html. We need to configure your server/domain’s document root to the
For changing the main/primary domain, you will need to have
root SSH access, and be able to locate and edit the following file (replacing your user & domain info):
1. Once you open the file, look for the following line:
2. Modify the location like this:
3. Save it and exit.
4. Rebuild the Apache conf and restart Apache:
/scripts/rebuildhttpdconf service httpd restart
The change will be immediate. Simply clear your browser cache and force refresh the page!
Changing Add-on Domains
Changing the document root for Add-on domains is easy. Simply log into your cPanel and navigate to: Domains >> Add-on domains.
Next, edit the Add-on domain path. To do so, simply click the “Edit” icon next to the path, and type in your new path. It’s that simple!