How to create a subdomain on website in cPanel
  John Mwaniki /   31 Aug 2021

How to create a subdomain on website in cPanel

What is a Subdomain?

A subdomain is a domain name, which is part of the primary domain name. The website files for this domain reside within the same server/hosting account as the primary domain.

Let say, for example, you have a domain name example.com, you can create a subdomain blog.example.com. Its files will be stored in the same server as those of example.com.

Most web hosting providers allow the creation of as many subdomains as you desire in your cPanel.

Subdomains are mostly applicable if you want to include content that is distinct from the rest of the site.

You may also want to use them to split your site into different sections according to their functions. Each subdomain works as an entirely different website although it shares the primary domain with the main site and the other subdomains.

Example

Google as an example has a lot of subdomains. The primary domain (google.com) is reserved for web searches while the rest of its products are distributed across subdomains.

Examples of Google subdomains that you most likely already know:

  • mail.google.com
  • play.google.com
  • developers.google.com
  • docs.google.com
  • drive.google.com
  • ads.google.com
  • gsuite.google.com
  • jobs.google.com
  • etc

How to create a subdomain in cPanel

Step 1: Click “Subdomains” under the Domains section

cPanel subdomains

Step 2: Enter the Subdomain name you want to create(eg if you want to create example.webdevsplanet.com, enter "example").

Select the primary Domain for your subdomain. The Document Root will be automatically filled according to your Subdomain.

You can leave it as it is or you can change and specify the directory of your choice eg "/public_html/example". Click “Create” button to create your Subdomain.

Creating subdomain

If your subdomain is created successfully, then you will see a Success message.

Subdomain creation success

The new subdomain will now be visible under the list of subdomains.

List of cpanel subdomains

A folder/directory will be created in the File Manager where you can create/upload your subdomain website files.

Subdomain directory

The subdomain folder is created under the public_html directory by default in some hosts.

The homepage for your subdomain needs to be named as index eg index.php or index.html in order to be loaded automatically when one clicks the subdomain link.

Managing redirection for your subdomain

If for some reason you may want to point your subdomain to another directory or to a different domain name, you can do so by clicking “Manage Redirection” on the corresponding subdomain in the subdomains list as shown below.

Redirecting a subdomain

You will be taken to the screen, where you can manage redirection for your subdomain as shown below.

Redirecting subdomain to another URL

Enter the new URL, where you want to redirect your subdomain to. Click “Save” and your redirection will be saved successfully. If you want to disable the redirection, later on, you may click “Disable Redirection”.