×

How to Change the Document Root of a Domain?

In web hosting, the Document Root is the folder on the server where the files for a specific domain or subdomain are stored. It is the directory that the web server uses to serve your website’s content when someone visits your domain in a browser.

For example:

  • The Document Root for the primary domain is typically:
    /public_html

  • A subdomain like blog.yourdomain.com might have a document root such as:
    /public_html/blog

  • An addon domain like anotherdomain.com could use:
    /public_html/anotherdomain


Why You Might Want to Change the Document Root
Some common reasons include:

  • Deploying a new version of your website in a separate directory.
  • Organizing your files for better separation between domains.
  • Using a custom framework or CMS that resides in a different folder.
  • Switching between staging and production environments.

Notes: Changing the document root may temporarily disrupt access to your website if not handled correctly. Make sure that the new folder contains a valid index.php or index.html file to avoid displaying directory listings or errors. After the document root is changed, clear your browser cache and test your website thoroughly.

Can I Change the Document Root in cPanel?
By default, cPanel does not allow users to change the document root of a domain or subdomain once it has been created. The document root is defined when the domain or subdomain is initially set up, and cannot be edited afterward through the cPanel interface.

If you need to change the document root for any reason—such as pointing your domain to a different folder or directory—this can only be done by your hosting provider's technical support team.