Last updated:
A subdomain is an additional section of your main domain. If, for instance, you want to set up a blog that is separate from your main site then you can create a subdomain such as blog.example.net. This article explains how to create and manage subdomains in cPanel, and also covers some common issues / misconceptions.
cPanel’s Subdomains interface has two parts:
To create a subdomain you typically only need to enter the name, as shown in the below image.
Image: creating the subdomain blog.example.net.
Here, I created the subdomain blog, which belongs to the domain example.net. The Document Root defines where the website files are stored. cPanel automatically suggests a directory based on the name of the subdirectory. You can of course change the directory, and the folder is created if it doesn’t yet exist.
Existing subdomains are listed under the header Modify a Subdomain.
Image: the list with existing subdomains.
There are two subdomains in the above image. The first is the subdomain we just created (blog.example.net). The other subdomain, example.example.net, is linked to an addon domain. In cPanel, each addon domain has a subdomain. So, if you see a subdomain you don’t recognise, it is likely to be an addon domain.
For each domain you got the following options:
Technically speaking, subdomains are independent. 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.net and blog.example.net are unrelated websites. This can be a disadvantage. For instance, if you get lots of traffic to blog.example.net then that doesn’t benefit the ranking of the domain example.net, 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. One good use-case is a development site. For instance, you could use a domain like dev.example.net if you are working on a brand new website.
Removing a subdomain doesn’t remove website files and databases. Instead, cPanel changes the DNS so that the subdomain no longer resolves. The subdomain’s A record, for instance, is deleted.
Is is also worth noting that you can easily restore a subdomain that was deleted. Because the website files aren’t removed you can simply recreate the subdomain. Provided that the website files still exist you only need to make sure that the subdomain is pointing to the correct document root.
You can change the directory in which the website files for a subdomain are stored as follows: