Please read before creating a subdomain.

We do have a video tutorial which will show you how to create a subdomain in cPanel.

Watch Video Tutorial!

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

Note: Some subdomain names are reserved: mail, www, ftp, cpanel, whm, webmail, webdisk. You can use any name except these.

How do I create a subdomain?

  1. Log into cPanel and click on the "Subdomains" icon.
  2. In the "Subdomain" field, please select the name of the subdomain which you wish to use, for example, you might choose "blog". If you choose blog, then your subdomain will look like "blog.example.com".
  3. Next, select the desired domain you wish to create this subdomain for from the drop down menu to the right of the "Subdomain" field. You may create a subdomain for any addon, parked or subdomain that already exists in your cPanel.
  4. When you click on the "Document Root" field, it should automatically populate with a cPanel suggested location from which the subdomain will load it's content. For instance, if you chose "blog" as your new subdomain, then the "Document Root" field will populate with "/public_html/blog". This means that the new subdomain will load it's content from the folder named "blog" from within the "public_html" directory.
  5. Once all three fields are set the way you prefer, simply click on the "Create" button to complete the creation of your new subdomain.

Note: The temporary URL for an addon or subdomain is
http://ipaddress/~username/subfolder/ or http://servername/~username/subfolder/
where the username is your cPanel user name for your primary domain.

Examples

http://gator123.hostgator.com/~username/addon.com/
http://gator123.hostgator.com/~username/subdomain/

If you have addon or parked domains that you wish to have the same subdomain name for, but wish for those subdomains to load different content, then you must pay close attention to the "Document Root" field. For example, if you own several domains and wish to have a different blog set up for each domain that loads from the subdomain name blog, then you will have change the "Document Root" of each domain that you set up. This is very important because if you create blog.hostgator.com and blog.seohosting.com on the same cPanel, but leave the "Document Root" as the cPanel suggested location, then both of your blog subdomains will load from the same directory of "/public_html/blog" and you will not have separate content for each subdomain.

To avoid experiencing 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, then you will have more than one domain using "blog" as a subdomain, but both subdomains will be loading separate content.


Article Comments

TerryWC
This is very helpful for setting up a sub-domain for me...Thank you

Cindy
I followed these steps but when I try to go to the subdomain in the browser, i get a message that the url can't be found. how long does it take before it is active?

HostGator
Due to DNS propagation, the subdomain can take up to 4 hours to start working.

John
I set up a subdomain, however it redirects to the folder location after the domain, instead of before.

HostGator
Likely, you need to remove the redirect. Check cPanel > Subdomains and make sure there is no redirection setup. Next, check cPanel > Redirects and make sure the same thing.

If you still have not solved the problem, then the redirect may be caused by rewrite code in your .htaccess file, source-code found in your page, or a URL saved in your database.

gk Eckert
How can I edit the name of the sub-domain, or edit the Document root!

How do I get into my subdomain to add content, through my home wordpress account?

HostGator
To change the subdomain name or change the document root, you must delete and recreate the Subdomain entry in your control panel.

If you want to add content with WordPress, you will need to install WordPress on that subdomain.

Ambi
I created a subdomain, but when i login to the subdomain/cpanel, i get authentication error. I am sure that I have entered the correct login details.
What could be wrong?

HostGator
You do not have a separate cPanel login for addon and subdomains.

Use the regular cPanel username and password from your welcome email.

rocketsRedglare
Is it possible to have seperate cpanel for addon or subdomains?

HostGator
No, that is not possible on shared hosting plans.

You can accomplish this by upgrading to reseller or higher. Then, instead of making Addon domains, make new cPanels accounts. Also, a subdomain name can be used as the main domain of a new cPanel.

Abdy
Is it possible to have a seperate document-root for the subdomain which is NOT in the document root of the main-domain?

If not, how can I protect the directory to make it accessible as subdomain.domain.com and not accessible trough domain.com/subdomain?

HostGator
Yes, what you propose will work. I do that often with my Addon domains.

Just create the domain as normal, but in the Document Root path, remove "public_html/" and just type the folder name. The root folder will appear outside of public_html.

Nicholas
Is it possible to create a "webmail" subdomain for an addon domain?

HostGator
Sure, you can create any subdomain names you like.

If you want it to function as a shortcut to webmail, simply redirect it to youraddondomain.com/webmail or webmail.yourprimarydomain.com

Jais joseph
Is it possible to change the default Document Root of the main domain to a desired one

HostGator
Please search for "Document Root Changes" or visit http://support.hostgator.com/articles/cpanel/document-root-changes

BASTA!
I do not see the Document Root field in cPanel's Subdomains page. Therefore I am unable to create a subdomain with non-default Document Root. Neither can I change the Document Root for existing subdomain. HOW TO? Using cPanel 10.

HostGator
That's not cPanel 10, it's cPanel 11 using the X theme. This article is written for the X3 theme (which we enable and recommend).

In the X theme, the Document Root cannot be changed. It will always default to a folder with the same name as your subdomain part, and inside public_html. I recommend switching your interface to X3.

Michael
cPanel automatically adds "/public_html/" in front of the folder name, even using the X3 theme. If the "/public_html/"is removed. It still creates the subdomain folder inside "public_html" on the server.

HostGator
Not true, Michael. I am able to create new Addon domains outside of public_html as explained in previous comments.

Jais Joseph
Is it possible to change the document root of the subdomain to a directory in /home/username/

HostGator
Yes, it works great. Just try it.

Tiel
THis...is...awesome..

Probably because I just finished an assignment with this...

Hostgator for the win! :)

Misha
Instead of a subdomain like "hello.example.com", can I have it as "example.com/hello" instead? How would I do that?

HostGator
Do not create a subdomain. Instead, go to File Manager and create a folder called "hello" inside your web root (for your primary domain, the web root is public_html).

Now you can upload files to the hello folder via FTP, and they will become available online.

zogger
I have a hatchling plan. Will it cost extra to create a subdomain or an addon domain?

HostGator
Subdomains can be created for free.

Addon domains cannot be used by Hatchling. You must upgrade to at least a Baby plan, then you can add Addon domains for free.


Your comments help us keep the knowledge base updated. This is not a medium for support. If you have questions or need help, please contact us via email, phone or live chat for fast assistance.

Post Comment