1. Knowledge Base
  2. >
  3. Results
  4. >
  5. Please Read Before Creating a Subdomain

Please Read Before Creating a Subdomain

When you create a subdomain in cPanel, you will be asked to choose the subdomain's name, the domain the subdomain is for, and the location from which the new subdomain will load its content.

Note: Some subdomain names are reserved: mail, www, FTP, cPanel, WHM, webmail, webdisk. You can use any name except these.

Here is a list of terminologies used in this article.

TermsDefinition
Domain Name

A domain identifies your website in the world-wide-web.

Reference: What Is a Domain Name?

Subdomain Name

A subdomain is a prefix added to the website to organize and navigate a website easily. Suppose that your website is "snappygator.com," while your shop could be "shop.snappygator.com."

Reference: What is a Subdomain?

Document Root

This is also known as web server document root. It is a folder where the website files are kept on the server. Each domain name has its unique folder on the server.

Reference: What is a Document Root Folder?


How to Create a Subdomain

  1. Log in to cPanel.
     
  2. Look for the Domains section, then click on the Subdomains icon. 

    Hostgator cPanel Subdomain Icon
     

  3. In the Subdomain field, enter the name of the subdomain you wish to use. For example, if you choose "blog," your subdomain will be: blog.example.com

    HostGator cPanel Create Subdomain section

  4. In the adjacent dropdown menu, select the domain for which you wish to create this subdomain. You may create a subdomain for any addon domain or parked domain that already exists in your cPanel.
    Addon domains automatically create a corresponding subdomain that reflects the addon domain and primary domain.
  5. The Document Root field should automatically populate with a suggested location from which the subdomain will load its content.
    • For instance, if you chose "blog" as your new subdomain, then the Document Root field will populate with "blog.example.com." This means that the new subdomain will load its content from the folder named blog from within the public_html directory.

    You may also enter your preferred document root or directory for your subdomain – just make sure it is not a duplicate.

  6. Once all three fields are set, click Create to complete the creation of your new subdomain. You should see the new subdomain and its document root just below that same page.

Document Root for Subdomains

If you have addon domains or parked domains, which you wish to have the same subdomain name but wish for those subdomains to load different content, then pay close attention to the Document Root field when creating a subdomain.

Why Document Roots Cannot be the Same

This is very important because if you create blog.hostgator.com and blog.seohosting.com on the same cPanel, leave the Document Root as the cPanel suggested location, both of your blog subdomains will load from the same directory of /public_html/blog. You will not have separate content for each subdomain.

Furthermore, if you own several domains and wish to have a different blog set up for each domain that loads from the subdomain name blog, you will have to change each domain's document root.

How to Avoid Duplicate Document Roots

To avoid this issue, when you create your new subdomain, make sure you set the document root to something other than /public_html/blog; instead, set it to something like /public_html/blog1. If you have done this correctly, you will have more than one domain using "blog" as a subdomain, but both subdomains will be loading separate content.