Skip to content

Instantly share code, notes, and snippets.

@sserbest
Created June 30, 2017 20:14
Show Gist options
  • Save sserbest/fe51c766ea28dfdbf7290ccdbbf53c9d to your computer and use it in GitHub Desktop.
Save sserbest/fe51c766ea28dfdbf7290ccdbbf53c9d to your computer and use it in GitHub Desktop.
Changing Primary folder on Cpanel

For changing the main/primary domain, you will need to have root SSH access and be able to locate and edit the following file (replacing your user & domain info):

/var/cpanel/userdata/USERNAME/DOMAIN.COM
  1. Once you have opened the file, look for the following line:
documentroot: /home/USERNAME/public_html
  1. Modify the location according to your needs. Save it and exit.
  2. Rebuild the Apache conf and restart Apache:
/scripts/rebuildhttpdconf
service httpd restart

The change will be immediate. Simply clear your browser cache and force refresh the page!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment