Document Root Changes
Updating the document root folder of a domain name changes the actual location of a site's files. Your primary domain uses the public_html folder by default. Please note that there is no real benefit in changing the current addon domain's document root unless it is strictly for "visual purposes" or if it's required for site development. If it's not really required, it is better to keep the current document root to prevent breaking the site.
This article discusses the following topics:
- How to modify the document root for an addon domain or subdomain ⤵
- Alternatives to changing the document root for the primary domain ⤵
How to modify the document root for an addon domain or subdomain
The directories or folders of addon domains and/or subdomains are created within the home directory of the cPanel.
To change the document root folder:
-
Log in to cPanel.
- In the Domains section, click on Domains.
- Locate the addon domain (or subdomain) you wish to modify, then click on the Manage button.
- Update the document root under New Document Root.
- Once done, click Update.
The document root should immediately reflect the update. Please move the site's contents into the new document root so the server will know where to search for your website's contents.
Alternatives to changing the document root for the primary domain
If you still want your primary domain to use a root folder other than public_html, you have two options:
- Change the primary domain name on your account, then add the old primary domain as an addon domain. This way, you can pick the root folder you want for the primary domain/new addon domain. (The new primary domain will now point to public_html.)
Note: You need to manually move the contents of the old primary domain into its new folder after you add the domain as an addon domain.
- Use mod rewrite to automatically redirect your website visitors to a new default directory. The new folder name will appear in the URL (i.e., http://domainname.com/subfolder/).