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.
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.