How to change the document root in cPanel

How to change the document root in cPanel

The document root is the folder a domain serves its website from.

Addon domains and subdomains

  1. In cPanel, open Domains.
  2. Click Manage beside the domain.
  3. Change the New Document Root and click Update.

Your main domain (public_html)

The main domain always uses public_html. To serve it from a subfolder (for example public_html/site), add this to public_html/.htaccess:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?yourdomain\.co\.uk$ [NC]
RewriteCond %{REQUEST_URI} !^/site/
RewriteRule ^(.*)$ /site/$1 [L]

Frameworks such as Laravel that need a public folder as the root can use the same approach. Test carefully after making changes.

    • Related Articles

    • How to add a domain to your hosting account

      You can host more than one website on the same cPanel account (subject to your package allowance). Make sure the domain's nameservers are set to ns0.thundercloud.uk and ns1.thundercloud.uk. In cPanel, open Domains in the Domains section. Click Create ...
    • How to change PHP version in cPanel

      Log in to cPanel and open MultiPHP Manager in the Software section. Tick the domain(s) you want to change. Choose the PHP version from the drop-down menu on the right and click Apply. The change takes effect immediately and only for the domains you ...
    • How to change MX records in cPanel

      MX records tell other mail servers where to deliver email for your domain. Change them when moving email to a provider such as Microsoft 365 or Google Workspace. Step 1: Set email routing In cPanel, open Email Routing in the Email section. Choose ...
    • How to change your hosting account password

      Your Managed Web account has two separate passwords: Client portal password – for billing, services, domains and support tickets cPanel password – for your hosting control panel, FTP (main account) and SSH Change your client portal password Log in to ...
    • How to log in to cPanel

      cPanel is the control panel for your Managed Web hosting. From it you manage your website files, email accounts, databases, DNS and more. Option 1: Through the client portal (recommended) Log in to your Managed Web client portal. Go to Services › My ...