A subdomain is a section of your site that you can keep separate from the rest. Considering the structure of a web address, the subdomain is the prefix of the domain, and it is separated from the latter by a dot:
In this article we will see how to create a subdomain for your site and edit and manage redirects for the subdomains you have created.
What are subdomains used for?
You can use a subdomain to create a separate section of the site that has an easy-to-remember address. For example, you could create a blog section for your business site.
Subdomains can be useful, especially for huge sites, where it would be hard to manage all the content without splitting it into sections. In addition to improving site management, these sections make it easier for users to navigate your site.
The procedure for creating a subdomain varies slightly depending on the cPanel theme you are using. In part one of this tutorial we will see how to make and manage subdomains using cPanel’s paper lantern theme, in part two we will see how to do it using jupiter.
Subdomain: how to create and manage it (paper_lantern theme)
Let’s see how to add a subdomain.
How to create a subdomain
To create a subdomain, log in to cPanel and scroll down to the Domains section. Then click on the Subdomains item:
In the new window, you will need to enter the data that will allow you to create your subdomain:
Subdomain: here, you must enter the name you want to use for your subdomain.
Domain: if there are several domains, just select the one for which you want to create the subdomain from the drop-down menu.
Document root: after entering the subdomain name, this field will be generated automatically. What you see is the folder in which the subdomain will be located. If you wish so, you can also edit the field and choose a different folder.
After filling in the fields, click on Create.
How to edit a subdomain
After creating it, you can also edit an existing subdomain. To do this, click on Subdomains in the Domains section of the cPanel.
Just below the one dedicated to the creation, you will see another section that says Modify a subdomain, and below the list of all subdomains will show. Let’s see what kind of changes you can make.
Change the document root
By clicking on the pencil symbol next to the subdomain you want to change, you can change the folder in which the subdomain is maintained.
After clicking on it, a new window will open that will allow you to change the address, and to confirm, you will have to click on Change.
How to set up a redirect
In the edit subdomains section, you can also set up a redirect. Just click on Manage redirection as you see on this screen:
In the new window, you will need to enter the destination address of the redirect. This way, whoever visits the subdomain will be redirected to the new link you set here. Here is an example in this screenshot:
If you want to delete a redirect that you have set up, you will have to click on Manage redirect again and then on the Disable redirection button.
How to delete a subdomain
From the Modify a subdomains section, you can also delete a subdomain you have created. Just click on the Remove button next to the subdomain you want to delete.
A new window will open asking for confirmation. You will need to click on Delete subdomain to continue.
Remember that this deletion is final.
How to create a subdomain wildcard
Creating a wildcard subdomain allows you to redirect visitors to a single destination. That way whatever subdomain they are trying to visit will all be redirected to a single address.
A wildcard subdomain also allows you to point all subdomains to a single folder and show different content for each subdomain, all managed by a single CMS, this is the case of wordpress multisite.
This way you don’t have to create all the subdomains one by one.
To create a subdomain wildcard, just click on Subdomains from the Domains section of the cPanel and then create a new subdomain. This time, you’ll need to enter an asterisk (*) in the Subdomain field instead of a name, as follows:
In the Document Root field, you will need to enter the destination folder.
After creating the wildcard subdomain, you will need to make sure that the record A pointing to your server’s IP address is associated with it.
Check out our tutorial on DNS management to see how to add a record from cPanel.
Subdomain: creating and managing (jupiter theme)
If you’re using the jupiter theme, you won’t see the “Subdomains” tool, but the “Domains” tool only of cPanel which will look like this:
Let’s look at how to make and manage subdomains in this case.
How to create a subdomain
First, click on Domains as highlighted below:
In this section, you will see a list of all domains and subdomains. To create a new subdomain click on Create a New Domain:
In the “Domain” field you will need to enter the full subdomain and then click Submit.
For example, if you want to create a subdomain: blog.domain.com, you need to type the full name like this:
To edit a subdomain we have created, we go to the list of domains from Domains > Domains as we saw before. Then we click on Manage, like this:
The “Manage” tool enables us to:
- edit the root folder of the subdomain;
- delete the subdomain we created;
- set up a redirect.
Let’s see how to do that.
Editing the subdomain
From here we can edit the subdomain root:
Deleting the subdomain
From the “Management” section we can also delete the subdomain by clicking on the Remove Domain button that I have highlighted below:
Setting up a redirect for the subdomain
From the list of domains, by clicking on Manage, we can also see a number of optional resources.
Clicking on Modify the redirects will take us to the redirect management section of cPanel and we can create the redirect.
How to create a wildcard subdomain
In the same way we created a subdomain, we can create a wildcard subdomain. In this case, we write *.domain.com in the domain field:
You will just go and replace “domain.com” with the domain name. Note that you can only create a wildcard subdomain for an existing domain, one that is already associated with your account.
In the Document Root field we enter the directory.
After that we need to go and check that the subdomain we created has the correct IP address associated with it in the record A.