cPanel will let you change the document root for any existing domain except if it points at /public_html (because it considers this an 'Alias' or secondary domain, and assumes it does not have its own files).
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 a parked domain/Alias. Alternatively, you can create an addon domain instead of a parked domain and point it to the desired directory
If you have already added a parked domain (example: test.com ) and need to change the document root, then please follow the below steps:
- Go to the 'Domains' icon in cPanel
- Remove the 'parked domain/Alias(example : test.com)' domain
- Back on the 'Domains' area in cPanel, click 'Create a New Domain'
- Enter the domain name which was previously added as parked domain/Alias(example: test.com)
- Un-check the 'Share document root' checkbox, and enter '/new-document-root' into the text-box that appear
- The final, 'Subdomain' option can be left as-is.
To change the document root for an Addon Domain or Subdomain, you can proceed with the following steps.
- Log in to the cPanel account the addon or sub-domain is located.
- Access the "Home / Domains / Domains" interface in cPanel
- Locate the domain to change the document root and select "Manage."
- Change the document root under "New Document Root."
- Click "Update"
The current cPanel version is 108, the knowledgebase is added on 25/04/2023
