Change Primary Domain Documentroot in cPanel

Usually the default document root for each cPanel account is “public_html”, this is mostly fine with most of scripts but when it comes to times that you are using a framework which is suppose not to expose the main files in it’s public document root, it gets complicated.

Unfortunately there is no way to change the document root for the primary account of cPanel within the control panel itself, and the only way to do it is to have root access.

If you do have root access on your server then it will be easy to achieve that.

To change the document root simply edit the config file for the account you wish to modify, its located at:

look for the config documentroot and change it to the way you want it.

if you got ssl installed on your domain you will need to do the same change for another file at:

once done run the following cPanel scripts to rebuild the user data cache as well as rebuild the httpd configurations.

Lastly restart the apache by running:

Leave a Reply