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.
Install CSF Firewall In cPanel
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.
/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
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.
Comment
How was this article? – Change the document cPanel
You might also like
More from cPanel
How To Install A Cloudflare Origin SSL Certificate In cPanel
Free SSL Certificates from places like cPanel or Let's Encrypt are great. When Let's Encrypt first introduces free SSL Certificates …
Create a SWAP partition on CentOS, RHEL and AlmaLinux without a reboot
SWAP is a memory type that Linux NVMe VPS Servers use to process requests. Memory will be held in SWAP …
Help fixing Error: last request failed: [AUTH] Authentication failed.
The Error: last request failed: [AUTH] Authentication failed error can be caused by a range of things. It could be …