Last updated: 28 November 2023

A subdomain is an independent section of your main domain. They are often used for development websites. For instance, if you own the domain example.com then you can use a subdomain such as dev.example.com to test code changes.

Things to consider

Technically speaking, subdomains are separate from the main domain on your cPanel account. They have their own virtual host, and they can use a different PHP version.

Search engines such as Google also see subdomains as independent domains. As far as search engines are concerned example.com and blog.example.com are unrelated websites. This can be a disadvantage. For instance, if you get lots of traffic to blog.example.com then that doesn’t necessarily benefit the ranking of example.com, and vice versa.

As a rule of thumb, it is best to only use a subdomain for a section of a website that should be completely separate. I already mentioned that you can use a subdomain for a development or staging site. In the same way you can use a subdomain to keep a copy of an old website (such as archive.example.com).

Creating a subdomain

All types of domains are nowadays managed via the Domains interface. To create a subdomain you need to enter the domain (without the HTTP(S) protocol) and make sure that Share document root is not ticked.

Here, I create a subdomain. When you enter a subdomain, cPanel knows the domain should not share the document root with the main domain. So, you can simply enter the subdomain and hit the Submit button.

cPanel automatically suggests a name for the document root. This is where the website files are kept, and it always a folder in the public_html directory.

Subdomains and the Domains interface

The Domains interface doesn’t tell you whether or not a domain is a subdomain. However, it is fairly easy to identify a subdomain, as it is always a section of either the main domain or an addon domain. Of the four domains shown in the below image only git.example.com can be a subdomain.

The Domains page shown in the image lists four domains. You can deduce that git.example.com is a subdomain by looking at the domain name itself. Also, as subdomains always have their own document root it is fairly easy to spot a subdomain.

Managing subdomains

There are two options for managing subdomains: you can change the document root and remove the subdomain. Deleting a subdomain does not purge the website files (or any database used by the subdomain). If you accidentally delete a subdomain then you can simply recreate it.

The form used to manage subdomains. The main option is the delete the subdomain.