How to Change Document Root of Primary Domain in cPanel server

You must have root shell access for changing the primary domain document root in cPanel server, Use following steps to change document root of your primary domain in cPanel account:

Step 1: Use SSH to get shell access for your server as root account. Now edit following file.

# vim /var/cpanel/userdata/USERNAME/DOMAINNAME.COM
*Change USERNAME with your cPanel account name.
*Change DOMAINNAME.COM with your Primary domain name.

Step 2: After editing the mentioned file, search for text documentroot and change path as per your requirement.

documentroot: /home/USERNAME/public_html/NEW_PATH

Step 3: After making the changes, you need to rebuild Apache configuration file and restart Apache service. Use following commands to do it:

# /scripts/rebuildhttpdconf
# service httpd restart
Your changes will be permanently updated now. Check your website for reflecting changes.

Comments

Popular posts from this blog

SVN: File remains in conflict

HowTo: Enable extended logging for exim

12 tweakings for WHM/cPanel to speed up WordPress