Account Document Root in cPanel

By default, the account document root in cPanel when setting up an account is set as /home/[username]/public_html.

Account Document Root in cPanel

There may be occasions where this needs to be changed. When you set up a new account, you specify a primary domain to used with this account. To change the domain’s document root, you will need to access your web server through SSH as this option it not changeable within WHM itself.

As soon as you’ve logged in via SSH, cd into the /var/cpanel/userdata/ directory. When you add an account with cPanel, cPanel creates an account folder within this directory. Within this folder, a file should exist that is named based on the domain name specified when creating the account.

So the full path looks like the following.


Open this file and locate the line that specifies the document root.

documentroot: /home/[username]/public_html

This can be changed accordingly, and when done so, rebuild the apache configuration and restart apache. This can be done by running the following commands.

$ /scripts/rebuildhttpdconf
$ service apache restart

After running the commands the change will be immediate. If you haven’t done so already, ensure that you move your web files into the new document root location in order to view your website.