The document root is the folder on your hosting account that a domain, subdomain, or addon domain actually serves files from. If you built a new version of your site in a different folder, moved an app into a subfolder, or just organized your files differently, you can repoint a subdomain or addon domain to the new folder directly in your control panel, without deleting and recreating it.
Why You'd Need to Do This
A common case is when you install a fresh copy of your website or app in a new folder (for example, to test an update) and then want your subdomain to serve from that new folder instead of the old one. Changing the document root does this instantly, since it just changes which folder the web server looks in. It doesn't move, copy, or delete any files.
If you're not sure what a document root is in the first place, see What Is the public_html Folder and Why Do Your Website Files Go There?
Back up your account, or at least note down the current document root path, before making this change. If you point a domain to a folder that doesn't have the right files in it, visitors will see a blank page or a directory listing until you fix it.
In cPanel
- Log in to cPanel and go to Domains (on older cPanel themes, use Subdomains or Addon Domains instead).
- Find the subdomain or addon domain you want to change in the list.
- Click the pencil icon or Manage next to the Document Root column.
- Clear the existing path and type the path to the new folder (relative to your account's home directory), or use the folder picker if one is shown.
- Click Change or Save to confirm.
cPanel applies the change immediately. Reload the site in your browser to confirm it's now serving from the new folder.
In DirectAdmin
- Log in to DirectAdmin and go to Domain Setup.
- Select the domain, then find the subdomain or addon (pointer) domain in the list.
- Click the subdomain or domain name to open its settings, or use the Modify option next to it.
- Look for the Document Root or Directory field and change it to the new folder path.
- Click Save to apply the change.
If your DirectAdmin theme doesn't expose this field directly for subdomains, open a support ticket with the exact folder path you want to use and ZIPROF support can set it for you.
What Happens to Your Old Files
Changing the document root only changes the pointer. The files in the old folder stay exactly where they are; they're just no longer served by that domain or subdomain. You can leave them as a backup, move them elsewhere with File Manager, or delete them once you've confirmed the new folder is working correctly.
If the new folder is empty or missing an index file, visitors will see a blank page, a directory listing, or a 404 until you upload the right files there.