Understanding Document Roots

What is a Document Root?

The Document Root directory is the designated folder path that the web server searches within for web content. This guide is great to know if you plan to upload files & subfolders for a website either through the File Manager or (S)FTP. There are some details to be aware of..

When a cPanel is created, it has a default Document Root for the Primary domain example.com located at the following path.

/home/examp12/public_html/

Creating a folder, or subfolder, alone via (S)FTP or File Manager does not automatically make it a Document Root. There must be a cPanel & web server mapping between the (sub)domain name (foo.)example.com to the designated Document Root folder path.

When adding either a Addon domain or Subdomain they will each have their own corresponding Document Root directories which can be configured from the Addon DomainsSubdomains, or the Domains features within the Domains section of cPanel.

 

NOTE: We also have a great set of articles to go along with this guide for creating Addon domains, Subdomains, understanding Subdomains & Subfolders with File Structure as well as Getting Started with FTP.

 

Where is a domain's Document Root set in cPanel?

For the following example this guide will be using the Addon Domains feature of cPanel, however the same process can apply to the Subdomains feature as well. The Domains feature has a slightly different process which will be covered further along in the article.

Domains.png

NOTE: This action changes where the web server searches for your files. It does not rearrange your files in any way.

 

Notice the icon from the image below, this icon represents the default path to the cPanel's home directory /home/examp12/. Most commonly, a cPanel username such as 'examp12' is the shortened version of the Primary domain example.com from when the cPanel account was first created.


Screen_Shot_2021-12-21_at_12.38.43_PM.png

When entering the new Addon domain name into the New Domain Name text field, the Subdomain name & Document Root path will be automatically generated after typing the domain name. Suppose your Addon domain is called myexample2.com, then the Document Root path will default to '/home/examp12/myexample2.com'

/home/examp12/

/home/examp12/myexample2.com


You can change the default path of the Document Root to something more custom.
For example, you want to add myexample2.com and have the web server search inside the /home/examp12/public_html/myexample2.com/ directory, then you would change the Document Root text field as

public_html/myexample2.com/ 

      • You cannot use the following directories as a document root directory:
          • The account’s home directory itself (/)
          • Directories outside of the account’s home directory (./ and ../)
          • .cpanel
          • .trash
          • etc
          • mail
          • ssl
          • tmp
          • logs
          • .cphorde
          • .spamassassin
          • .htpasswds
          • var
          • cgi-bin
          • .ssh
          • perl5


What if I already added the domain, can I update the Document Root?

That is no problem. You can update the Document Root path from the Addon Domains, Subdomains, and Domains feature pages.

Addon & Subdomain:

For the Addon & Subdomain pages you will want to look for the list of (sub)domains which have been already added, as shown below. Look to the second column for Document Root and click on the pencil to the right. This will open a popup in order to update the path.

Screen_Shot_2021-12-21_at_3.40.05_PM.png

Screen_Shot_2021-12-21_at_3.43.09_PM.png

Screen_Shot_2021-12-21_at_3.45.28_PM.png

Screen_Shot_2021-12-21_at_3.56.07_PM.png

You can see now the Document Root was updated to public_html/myexample2.com/ shorthand for /home/examp12/public_html/myexample2.com/.

 

Document Root on the Domains page:

To update the Document Root on the Domains page is a little different but overall similar in process. First, click on the Domains feature in cPanel. You should see the list of all domains including the Primary. There is a button to the right which states Create A New Domain, however for the example domain myexample2.com was already added in previous steps above so we'll be changing the Document Root back to it's original /home/examp12/myexample2.com/ directory.

Screen_Shot_2021-12-21_at_3.57.35_PM.png

Look to the far right for the Manage button.

 

You should now see the text box that allows you to edit the path of the Document Root. Retype the path to the correct folder you want then click the Update button. You can also Remove the domain as well if you wish.

Screen_Shot_2021-12-21_at_4.04.12_PM.png

Once updated the cPanel & web server will now search back to the folder
public_html/myexample2.com/

Screen_Shot_2021-12-21_at_4.38.11_PM.png

 

What if I want to update the Primary domain Document Root?

For this type of request it cannot be done through the cPanel but we can update this for you. You can reach out to our Support Team (support@reclaimhosting.com) and we can help make the switch. That's it!

Was this article helpful?
0 out of 0 found this helpful

Articles in this section

See more
Reclaim Hosting Support Hours
8:00 am - 5:00 pm ET, Monday through Friday
Submit a Ticket
Get a quick and helpful response from the pros.
Need Extra Support?
No problem, we're here to help! Talk to us about Professional Services or custom Service Level Agreements.