Change Primary Domain Document Root in cPanel/WHM Print

  • 0

Step 1)  Use nano or your preferred text editor to edit the files. Once the content of each file will open in the editor, you will have to update the “documentroot” value to the new path in the following files:

 

/var/cpanel/userdata/cPanelUsername/domain.tld

/var/cpanel/userdata/cPanelUsername/domain.tld_SSL

 

Edit Document root to any location

 

Eg: documentroot from /home/cPanelUsername/public_html to /home/cPanelUsername/zen/public

 

Step 2) The next step is to remove the existing cache files:

 

rm /var/cpanel/userdata/cPanelUsername/domain.tld.cache 

rm /var/cpanel/userdata/cPanelUsername/domain.tld_SSL.cache

 

Step 3) Rebuild the cache files and the Apache configuration file:

 

/scripts/updateuserdatacache

/scripts/rebuildhttpdconf

Step 4)  Restart Apache:

 

/scripts/restartsrv_httpd

After following the steps described in this tutorial, the primary domain of your cPanel account will be loading the content from the new documentroot that you’ve set.


Was this answer helpful?

« Back