cPanel & WHM

Change document cPanel – Change Domains Root

The document root folder is the folder that Apache will use to look for the files associated with the website set up in WHM. The default document root folder is always the public_html folder located at /home/cPanel-Username/public_html. In some cases, it might be required to change the document root in cPanel VPS to point to a different folder. Or even a different location. In this guide, we will change the document root of a website to point to a new folder in the same account which has been set up inside WHM.

Change the Document Root Path

In the following two files first, modify the document root path to point to the correct path. You are changing the values for both the secure and insecure versions. Remember to change both or you will get inaccurate results.

/var/cpanel/userdata/CPusername/user-domain.tld
/var/cpanel/userdata/CPusername/user-domain.tld_SSL

Once you have your new document root path placed in the correct files next, remove the existing cache files

rm /var/cpanel/userdata/CPusername/user-domain.tld.cache
rm /var/cpanel/userdata/CPusername/user-domain.tld_SSL.cache

Rebuilt Apache Cache

Then rebuild the cache files and rebuild the Apache configuration file

/scripts/updateuserdatacache<br>/scripts/rebuildhttpdconf

Finally, restart Apache and your new document root path will come into effect.

/scripts/restartsrv_httpd

That is the process complete and you have now updated the document root path of a domain name setup in WHM.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button