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.

Creating a subdomain

cPanel’s Subdomains interface has two parts:

  • You can create a new subdomain at the top of the page.
  • You can modify (or remove) existing subdomains at the bottom of the page.

To create a subdomain you typically only need to enter the name, as shown in the below image.

Creating a subdomain in cPanel.
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.

Modifying a subdomain

Existing subdomains are listed under the header Modify a Subdomain.

The list with existing subdomains.
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:

  • The Document Root link opens the directory in the file manager.
  • Clicking on the pencil icon lets you change the document root. In other words, you can use this option to change the directory in which the the website files are stored. cPanel automatically creates the directory if it doesn’t exist. However, it doesn’t move the files from the old to the new directory.
  • The Remove link deletes the subdomain. As explained in more detail below, the root directory is not removed. If you also want to remove the website files then you need to do that manually.
  • The Manage Redirection link creates a redirect. You can use this option to point the subdomain to a different domain.

Frequently asked questions

Is a subdomain a separate domain?

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.

Does removing a subdomain delete the website files?

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.

What is the best way to change the document root?

You can change the directory in which the website files for a subdomain are stored as follows:

  • Make a backup of your account (just in case things go horribly wrong!).
  • Rename the directory in which the website files are currently stored (using the file manager).
  • On the Subdomains page, click on the pencil icon to the right of the document root name.
  • Enter the name of the new document root in the pop-up window.