It is possible to change the document root for addon domains and subdomains of an account, but cPanel does not currently have a feature to change the document root of the primary domain.
There is an existing feature request for this here:
Although cPanel does not currently offer a feature to allow this functionality, you may use the following procedure as a workaround to change the document root for your primary domain.
In order to work around the existing limitation, you may change the primary domain of an account to a placeholder domain, and then add your previous primary domain as an addon domain.
- 1. -- CRITICAL -> Create a backup of the account with the following instructions:
How to generate a backup of my entire cPanel account
- 2. Remove any subdomains of the primary domain
- 3. Login to WHM as the root user
- 4. Navigate to: Home »Account Functions »Modify an Account
- 5. Select the user that you would like to modify, then click the Modify button
- 6. Change the primary domain to a placeholder domain such as: placeholder01.tld
- 7. Do not modify any other settings, and then click the Save button at the bottom of the page
- 8. Navigate to: Home »Account Information »List Accounts
- 9. Click on the orange cP icon for the account to login
- 10. Click on the Domains icon
- 11. Click "Create a New Domain" in the upper right area
- 12. Enter the domain that you were previously using as the primary domain
- 13. Enter your desired document root
- 14. Click the blue Submit button
- 15. Add any subdomains that were previously on the account back to the account