Change document root of a domain setup in cPanel
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.
Update the Document Root Path
In the following two files first, modify the document root path to point to the correct path. You changing the values for both the secure and insecure version. Remember to change both or you will get inaccurate results.
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
Then rebuild the cache files and rebuild the Apache configuration file
Finally, restart Apache and your new document root path will come into effect.
That is the process complete and you have now updated the document root path of a domain name setup in WHM.
How was this article? – Change the document cPanel
You might also like
More from cPanel
Free SSL Certificates from places like cPanel or Let's Encrypt are great. When Let's Encrypt first introduces free SSL Certificates …
SWAP is a memory type that Linux NVMe VPS Servers use to process requests. Memory will be held in SWAP …
The Error: last request failed: [AUTH] Authentication failed error can be caused by a range of things. It could be …