The Document Root is the directory where the files for a particular domain or subdomain are stored on your server. By default, cPanel assigns a specific document root for each domain, typically within the public_html directory. Changing the document root can be useful if you want to point the domain to a different directory or manage multiple websites on the same hosting account.
In cPanel, you can modify the document root through the Addon Domains or Subdomains section. This flexibility allows you to configure different directories for different sites or environments (e.g., development vs. production). Changing the document root ensures that the domain or subdomain serves content from the correct folder.
Before changing the document root, make sure the new directory is properly configured and contains the necessary files for the domain. Incorrect configurations can result in the domain not displaying content correctly.
The document root can be changed for both addon domains and subdomains. Ensure you select the correct domain type.
Make sure the new document root directory exists in your file structure or create it using the File Manager in cPanel.
Example new document root: Old: /public_html/mydomain/ New: /home/user/custom_directory/
Once the document root is changed, the domain will load files from the new directory. Test the domain after making the change to ensure it works as expected.