Introduction
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:
features.cpanel.net - Enable document root change for primary domain
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.
Procedure
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.
- -- CRITICAL -> Create a backup of the account with the following instructions:
How to generate a backup of my entire cPanel account - Remove any subdomains of the primary domain
- Login to WHM as the root user
- Navigate to: Home »Account Functions »Modify an Account
- Select the user that you would like to modify, then click the Modify button
- Change the primary domain to a placeholder domain such as: placeholder01.tld
- Do not modify any other settings, and then click the Save button at the bottom of the page
- Navigate to: Home »Account Information »List Accounts
- Click on the orange cP icon for the account to login
- Click on the Domains icon
- Click "Create a New Domain" in the upper right area
- Enter the domain that you were previously using as the primary domain
- Enter your desired document root
- Click the blue Submit button
- Add any subdomains that were previously on the account back to the account