What is a subdomain, and how do you create a subdomain? In this article, I am going to tell you everything you need to know.
So, let us not waste time any further and get straight into business.
In this article I am going to answer the following questions:
- What is a subdomain?
- How to create a subdomain?
- Why or when do you use a subdomain?
- Differences between a subdomain and a subdirectory.
In essence, I will give you a complete subdomain guide that you can use whenever you need.
Let us begin.
What is a subdomain?
A subdomain is a prefix that you add to your domain name. This prefix-added URL will point to a completely different website.
Here is an example:
The domain for this blog is: https://cloudzat.com. This is the main domain.
This is a subdomain for the blog: https://subdomain.cloudzat.com/.
A subdomain has the following parts:
- The protocol: “https:” The protocol is nothing more than a set of guidelines.
- The TLD (or Top Level Domain): “.com.” This can be ‘.net,’ ‘.org,’ or any other extension.
- The SLD (or Second Level Domain): “Cloudzat.” It is the domain name that you purchase from any domain registrar.
- The prefix: “subdomain.” The prefix always comes after the double forward slashes (//) and before the SLD.
So, a subdomain can be anything. There are a few examples:
You get the point, right? The prefix can be anything.
A subdomain reflects a completely different URL from the original domain. The website that a user reaches using the subdomain is a completely different website.
I will get to this later in this article.
How to create a subdomain?
Any shared hosting company, or managed WP hosting company, or even a managed cloud hosting company will make it easy to create subdomains. However, creating a subdomain on a barebone cloud hosting requires some technical knowledge.
Since majority of the users use shared hosting to start their blogs or websites, this article will focus on shared hosting.
Here I will show you how to create a subdomain using cPanel.
Note: This method can be used for any shared hosting provider that offers cPanel. If you are using a provider like Bluehost, this method will not apply, because Bluehost has their custom control panel. The method of creating a subdomain using shared hosting providers that offer custom control panel differs from host to host.
Here are the steps:
Step 1: Log in into your cPanel and find subdomains option.
Your hosting provider will give you access to cPanel. The login credentials will be there in the welcome email you receive.
Use the credentials to login.
A typical cPanel will look like this:
You will notice how everything is segmented into groups. Scroll down to find the group called ‘Domains.’ This is how that group should look like:
You will find the option called ‘Subdomains.’ In the image above, I have highlighted it using a red box.
This option will be present irrespective of which shared hosting provider you are using. Yes, the option for subdomains will be there even when you are using hosting providers that do not use cPanel.
Step 2: Create subdomain
Once you have located the subdomains option, click on it. Doing so will take you to a new page where you will see the option of adding a subdomain. The primary domain will already be populated.
This is what you will see:
Now, enter the name for the subdomain (that is, the prefix that you want). The primary domain will be automatically select. You do not have to do anything unless you have multiple domains attached to the same hosting account.
In a scenario like that, select the domain from the dropdown.
In the Document Root field, do not write anything. Leave it empty. It will auto-populate when you hit the ‘Create’ button.
After you hit the ‘Create’ button, you will see a success notice that looks like this:
Once you have created the subdomain, click on the Go Back button that you see, it will show you the subdomain.
Notice how a new document root is created. It is different from the document root for your primary domain. The document root for the primary domain is usually depicted by public_html.
To verify, that a new document root is created, click on the document root of the subdomain. It will take you to the File Manager provided through cPanel.
In the File Manager you will see this:
Notice that there is a public_html folder. That is the document root for the primary domain name. The other one is the document root for the subdomain you created.
For every subdomain you create, a new document root will be created.
That is all! You have successfully created a subdomain.
Usually, hosting companies will allow creating unlimited subdomains. But do not be stupid. Create only those that you need.
Do not forget that the subdomains that you are creating will share the same hosting resources as RAM, CPU, etc. If you create too many subdomains, you will quickly run out of resources. There will be lags and freezes. That is when your hosting provider will ask you to upgrade.
Now, you can quickly install WordPress or any other software in your subdomain.
Usually, your hosting provider will give you access to Softaculous that will give you many scripts that you can install using one-click operation.
To install WordPress on your subdomain, simply select the subdomain during the installation process.
You are done!
Wasn’t that simple?
Why or when do you use a subdomain?
Wondering why or when you should use a subdomain? There are several use-case scenarios where a subdomain becomes handy.
Let us go through each option.
A staging site is essentially a replica of your main site. The only difference is that the staging site is not indexable by Google or other search engines. You can make the staging site indexable, but that is not advice on the following grounds:
- It is a replica, and so, there will be duplicate content issue when search engines index it.
- A staging site is an experimental site. You test things there. You will frequently make changes. Testing sites should not be discoverable by people. It leaves a bad impression and creates bad user experience.
You can use the subdomain to test new plugins, themes, or features. If it works out well, you can replicate that to your production site.
Unfortunately, using a subdomain as a staging site has a serious flaw. You can push the settings or features of the site to your main domain with a click of a button. That feature is absent in shared hosting. So, you need to manually copy everything.
During this copying process, things can go wrong! But if you are meticulous enough, you can do it the right way.
You might start out your internet entrepreneurship with a simple blog. Sometime later, you may decide to launch an online store for your brand. You can create the store on your main domain, or you can keep the store on the separate subdomain.
Usually, a separate subdomain for the store will be far better because you do not have to change anything in your primary domain. If something goes wrong during the store setup process, you can delete the subdomain and start from scratch.
Online store in the above scenario is a separate segment of your business. You might not want to create an online store. You may want something else. For example, you may want to create a quiz site, or perhaps a documentation site for the products and services you deal in.
You may want to take the customer service segment of your business on the subdomain with live chat and other features like FAQ, Q&A forum, etc.
You may want to build a multilingual site. Subdomains become handy in that case. You can always keep your translated sites in separate subdomains. For instance, if Cloudzat was translated into German, French, Spanish, Hebrew, Russian, Kurdish, etc. I would prefer having the following subdomains:
- https://de.cloudzat.com/ (for German)
- https://fr.cloudzat.com/ (for French)
- https://es.cloudzat.com/ (for Spanish)
- https://he.cloudzat.com/ (for Hebrew)
- https://ru.cloudzat.com/ (for Russian)
- https://ku.cloudzat.com/ (for Kurdish)
Keeping different language versions on separate subdomains will make management an easy task. If something goes wrong with one subdomain, the other language sites will remain functional, and keep catering the visitors.
You can use subdomains for all these purposes.
You can always come up with different use-case scenarios. Afterall, every website is different, and so are its needs and expansion plans. The purpose of the subdomain(s) you create will depend on what you want to achieve.
Difference between a subdomain and a subdirectory
May I have your full attention please?
This is important!
You may find people who will say that the following two formats both represent a subdomain:
Should you believe them?
Well, technically both will be pointing you to new websites that are completely different from the main domain.
So, you can call both as subdomains.
But the problem shows up from the SEO standpoint.
Search engine optimizers will call https://subdomain.yoursite.com/ as subdomain.
But they will refer to https://yoursite.com/subdomain/ as a subdirectory.
How does the two differ?
The main difference between the two is that in the first option (https://subdomain.yoursite.com/), a new document root is created. This completely separates the website from your main domain.
For the second one (https://yoursite.com/subdomain/) a new document root is NOT created. The folder stays inside the document root of your primary domain.
So, with a subdirectory, you will be installing another website inside the root directory or your main website. This makes the subdirectory website a part of your main website. It will not be a separate website.
This has a huge implication from the SEO standpoint.
Google or any search engine always considers a subdomain as a different website. However, they will consider a subdirectory as a part of the same website.
So, when you create a subdomain, making that subdomain rank will be just as difficult as it is to make the main domain rank in SERPs.
You must optimize the entire subdomain and treat it as a separate site. You cannot think that the link juice from your main domain will transfer to the subdomain. That will never happen!
On the other hand, a website in the subdirectory will get the link juice of the main domain, because it sits inside the root folder of the main website. All search engines will consider it a part of your main domain. No search engine will treat it as a separate website.
When to use subdomain and when to use subdirectory?
If you are not sure when to use a subdomain and when to use a subdirectory, just remember this thing:
- Use subdirectory when you do not want your new site to rank for separate keywords or key phrases.
- Use subdirectory when you do not want to target new markets.
- Using subdirectory makes sense when you want your new website to quickly rank for the blogs your write using the support of your main domain’s link juice.
On the other hand:
- Use a subdomain when you want to target a completely different market.
- Use subdomain when you are targeting a completely different niche with different keywords and key phrases.
- Use subdomain when you want to serve your site in language different from your main website’s language.
You need to define and determine the use case scenarios.
For example, Cloudzat is all about technology related to consumers. It operates in B2C segment. Now, if Cloudzat want to target enterprises in the B2B market, using a subdomain will make more sense rather than using a subdirectory.
Understand that B2C is a different market from B2B.
So, having https://business.cloudzat.com/ makes more sense than using https://cloudzat.com/business/.
However, if Cloudzat suddenly wanted to provide information on smartphones (something that Cloudzat does not do) for consumers, a subdirectory will make more sense. In that case, https://cloudzat.com/smartphone-reviews/ makes more sense.
Creating a subdomain is not difficult. Determining the purpose of a subdomain is difficult. You need to understand when you should be using subdomain, and when you should not be using it. Having a clear idea will ensure that your online endeavors do not go astray.
Proper planning will give you a proper direction that will improve your chances of success. Doing things randomly will only eventually lead to failures.
Finally, thank you for reading! If you have any questions, feel free to drop a message.