A subdomain is used to direct traffic to a directory in your website. As an example, say you have a members-only section of your website, and the files are in /public_html/members. The URL for the member’s area would be https://ggexample.com/members/.
When you create a subdomain, you can use the URL https://members.ggexample.com. Both URLs lead to the same files. The subdomain gives you another URL option.
In this tutorial, I will show you how to create a subdomain in cPanel. You’ll also see how to edit a subdomain in cPanel and I will touch on when a subdomain should (and shouldn’t) be used.
What Is a Subdomain?
A subdomain is a name that is part of your primary domain. You can recognize a subdomain when there is a section of a website URL that comes before the primary domain. In the example above, the subdomain is members.ggexample.com, and the primary domain is ggexample.com.
Subdomains are typically used to designate a separate section of a website, or in some cases, a completely different website.
When you create a subdomain, an A record is added to your domain’s DNS zone. An entry is also made in a configuration file on the web server. This is so the server knows where to direct the subdomain traffic.
How to Create a Subdomain
Log in to cPanel.
In the “Domains” section, click the “Subdomains” link or icon.
In the “Subdomain” field, enter the name of your subdomain. That’s the section that precedes the main domain, e.g., members.ggexample.com.
If you have multiple domains in your cPanel account, choose the domain on which you wish to create a subdomain from “Domain” drop-down.
The “Document Root” is the root directory for the subdomain. So in our example above, the subdomain root directory would be /public_html/members.
Click the “Create” button.
When the subdomain has been created, you will see a success message.
The subdomain should be available to view in 5 to 10 minutes. Since you are making a DNS update, it may take a while for the new DNS record to propagate across the internet. Usually, propagation will complete in an hour or two.
This is why you might see a 404 page if you create a subdomain and immediately install something like WordPress. If you try to access the site a few minutes after creating the subdomain, you might receive a 404 not found error.
Just give it a bit of time before you try accessing the subdomain.
Creating a Wildcard Subdomain
A wildcard subdomain is used if you want to point any subdomain of your domain name to a specific directory in your site.
When you create a wildcard domain, any subdomain prefix typed before your domain will lead to the subdomain root directory. So pacific.ggexample.com, members.ggexample.com and asdf99qwer.ggexample.com could all lead to the same directory on the site.
To create a wildcard domain, use the same method detailed above, but enter * in the “Subdomain” field.
Depending on your host, creating a wildcard subdomain may involve manual DNS zone editing. Take a look at this cPanel article for more details.
Editing, Deleting or Redirecting a Subdomain
To Change the Root Directory for a Subdomain
Scroll down to the “Modify a Subdomain” section and click the pencil icon for the subdomain. Clicking the path link will take you to the file editor, which you don’t want.
Enter the new directory name in the “Document Root” field, and click the “Change” button.
To Delete a Subdomain
Scroll down to the “Modify a Subdomain” section and click the “Remove” link or icon.
Click the “Delete Subdomain” button.
To Redirect a Subdomain
Scroll down to the “Modify a Subdomain” section and click the “Manage Redirection” link or icon.
Enter the URL you wish to redirect the subdomain to and click the “Save” button.
To remove subdomain redirection, click the “Manage Redirection” link or icon, then click the “Disable Redirection” button.
When You Should Use a Subdomain
A subdomain is most commonly used when a website has a section that is separate from the primary site. Such as a blog, forum, control panel, member’s area and so forth.
Subdomains are also used for different regional or language versions of the same site. So, english.ggexample.com and spanish.ggexample.com, for instance. Or pacific.ggexample.com and atlantic.ggexample.com.
Often you will see subdomains used as personal areas of a broader community or social site. On ggexample.com, a user’s subdomain could be username.ggexample.com.
For most personal or smaller sites, whether or not to use a subdomain is a matter of personal preference. Since the destination is the same whether you use a subdomain or the /directory URL, it’s really just a matter of choice.
When You Should Not Use a Subdomain
While using a subdomain is a matter of personal preference, there are a couple of things to consider before creating a subdomain. One is maintenance. If you use subdomains and find it necessary to move your site to a new host, your move will involve additional configuration tasks.
Perhaps more importantly, subdomains affect how search engines see your site. To Google, a subdomain is a separate website. Traffic to blog.ggexample.com is seen as separate from the traffic to ggexample.com.
If you are building a brand, that can be a problem. This article goes into more detail on the subject.
Now that you are armed with more information about creating and using subdomains, are you more or less likely to create a subdomain for your website? If you currently use subdomains, do you have any concerns about the way search engines see your site?