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 of the subdomain, as shown in the below screenshot.

Creating a subdomain in cPanel.
Image: creating the subdomain blog.example.net.

Here, we created the subdomain blog, which belongs to the domain example.net. The Document Root field defines where the website files for the subdomain are stored. cPanel automatically suggests a directory based on the name of the subdirectory (public_html/blog, in our case). You can change the document root to another folder in the public_html directory. In most cases, though, you can simply hit the Create button.

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 screenshot. 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. If you see a subdomain you don’t recognise, it is likely to be an addon domain on your account.

For each domain you got the following options:

  • The Document Root link opens the directory in the file manager.
  • Clicking on the pencil icon to the right of the document root 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 will not move any files from the old to the new directory.
  • The Remove link deletes the subdomain. As explained in more detail below, the root directory will not be 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?

Search engines such as Google 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, will be deleted.

Even though the website files aren’t touched we do recommend making a backup of your account before you hit the Remove button.

It is worth noting that you can easily restore a subdomain that was deleted in error. 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.