List of content you will read in this article:
What is a subdomain?
A subdomain is a name that is part of your primary domain. The typical usage of a subdomain is to designate a separate section of a website or an entirely different website.
The easiest way to spot a subdomain is to see a separate section in the website URL before the primary domain. Let me give an example. When you go to Google, you will see the URL as follows https://www.google.com/, but when you open Gmail, it will change to https://mail.google.com/. As you can see the extension ‘mail’ was added before the primary domain.
A subdomain is used to direct traffic to a separate directory on your website. To elaborate on this idea, suppose you have a separate dashboard for the clients, and the files are stored in /public_html/dashboard directory. The respective URL for the dashboard would look like https://example.com/dashboard/.
But if you create a subdomain, instead of using that, you can use the following URL: https://dashboard.example.com.
In this tutorial, I will show you exactly how to do this for your website. Let’s start making subdomains using cPanel.
How to create a subdomain?
- Login to your cPanel
- Head down to the Domain section
- Click on the Subdomains menu
- In the opened window, enter the required details
Subdomain: Enter the name of your subdomain
Domain: Choose the domain name that you wish to create the subdomain from the provided list.
Document Root: The root directory for your subdomain (for example: /public_html/test)
- Click on the “Create” button
Note: Your visitors will not see the changes immediately. It will take up to 3 days to get it up and running on the internet. This is because the DNS records should be updated in all nameservers.
Congratulations! You created your first subdomain.
When to start using subdomains?
The main reason subdomains are used in websites, is to separate different sections from the primary site. These can be the blog, control panel, client area, forums, and so forth.
Another common usage is to differentiate between language and regional versions of the website. A few examples are:
Whether you use a subdomain or the directory URL boils down to small website owners’ personal preferences. Either way, the destination page would be the same.
Throughout this tutorial, we showed you how to set up subdomains on your website. However, before creating subdomains, you should note how search engines will interpret your website. Google will see the subdomain as a separate site. This means that the traffic coming to example.com is separated from the europe.example.com.
In the comments below, let us know if the steps mentioned here worked in creating subdomains for your site, and don’t forget to share with your colleagues.
Here is a complete guide about installing cPanel in CentOS.