Knowledgebase

Changing the Document Root of a Domain Print

  • cpanel, domain, ssl, filemanager, htaccess, caching, support, guide
  • 0

The document root is the folder a domain serves files from. Changing it is useful when a framework requires the site to be served from a /public subfolder, or when you want to swap which folder a domain shows.

CHANGING IT

  1. In cPanel open Domains.
  2. Click Manage beside the domain.
  3. Edit the Document Root field to the new path, for example public_html/newsite or public_html/app/public
  4. Click Update.

The folder must already exist. Create it in File Manager first.

TYPICAL USES

Laravel and similar frameworks: point the document root at the project's /public folder so the application code is not publicly reachable.

Launching a redesign: build the new site in a second folder, test it, then repoint the document root in one step.

Reorganising several sites on one account.

AFTER CHANGING

Clear your browser cache and test in a private window. Check for a leftover .htaccess in the old folder that may interfere. Re-run AutoSSL if the certificate now fails validation.

The primary domain's document root is public_html and cannot always be changed. If the option is unavailable, open a ticket and we will advise on the best structure.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot