change main root directory cpanel

1. access server terminal. using SSH or whatever you now
2. type "sudo su" in terminal to enter root access
3. $ sudo nano /var/cpanel/userdata/CPANEL_USERNAME/DOMAIN.COM
4. find following lines:
	documentroot: /home/USERNAME/public_html

	path: /home/USERNAME/public_html/cgi-bin
    
5. change "documentroot: /home/USERNAME/public_html" to "documentroot: /home/USERNAME/other-dir"
6. change "path: /home/USERNAME/public_html/cgi-bin" to "documentroot: /home/USERNAME/other-dir/cgi-bin"
7. type "sudo nano /var/cpanel/userdata/CPANEL_USERNAME/DOMAIN.COM_SSL" if you have SSL installed
8. find following lines:
	documentroot: /home/USERNAME/public_html
9. change "documentroot: /home/USERNAME/public_html" to "documentroot: /home/USERNAME/other-dir"
10. $ rm -vf /var/cpanel/userdata/username/domain.com.cache
11. $ rm -vf /var/cpanel/userdata/username/domain.com_SSL.cache
12. run "/scripts/updateuserdatacache"
13. run "/scripts/updateuserdomains"
14. run "cp /etc/apache2/conf/httpd.conf{,.bak-`date +%Y%m%d`}"
15. run "/scripts/rebuildhttpdconf"
16. run "/scripts/restartsrv_httpd"
17. last, run "service httpd restart" for restart apache service
	i use "sudo systemctl restart httpd.service" for centos 7

Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source