What Are Subdomains and How to Create One + the Differences Between Domains and Subdirectories
Subdomains locate additional content in a separate website without buying a new domain name. Using them, you can save money and improve your web development projects.
Technically speaking, www is the most popular subdomain. However, in this article, we’ll focus on other common subdomain examples, such as shop, blog, or support, as they serve a specific function.
Note that subdomains are different from subdirectories. Although both are part of a URL structure and useful for content organization, they differ in the technical aspects and impact on your site.
With this in mind, we’ll explain what exactly a subdomain is, its benefits, and show you how to create one. You’ll also learn whether a subdomain or a subdirectory is more suitable for your site.
What Are Subdomains?
Subdomains are the part that comes before the main domain name in the URL structure. They act as a domain extension to create an organized directory for a different website section.
What Are Subdomains Used For
Subdomains are great for organizing content on your website and improving its user experience.
For example, you may create a blog of your website placed in a separate subdomain, such as blog.website.com. Or, a business can use the shop.website.com subdomain for its online store.
There are two main reasons for doing so. First, a subdomain creates a separate site entity that lets you use a different website design and content structure. As a result, you can manage your websites easier, enabling users to find and navigate the content more quickly.
The second reason is that you can use a different website-building platform. If you have a static business website coded from scratch, you may want to use WordPress for its blog.
Here are more use cases of subdomains:
- Test environment. You can use a subdomain as a test environment to try new features without affecting the main site. That said, you should restrict access to the subdomain or password-protect it so it won’t be publicly available.
- Multilingual sites. If you want to create websites for different regions, you can use a subdomain like fr.website.com or es.website.com. This way, you don’t have to purchase another domain with the country-code top-level domain (TLD).
- Mobile version. While most websites have a responsive design to suit other devices, you can add a specific website for mobile users with a subdomain, such as m.website.com.
What Is the Difference Between a Subdomain and a Domain
Domains and subdomains are different parts of the URL structure.
A domain name is the unique name and address of the website. Generally speaking, it converts a website’s IP address into a string of letters or numbers to help people easily remember and identify the website. You can purchase a domain from a domain registrar.
Domain Name Checker
Instantly check domain name availability.
When talking about domain names, people usually refer to the combination of a top-level domain and its second-level domain. For example, hostinger.com and hostinger.fr.
A subdomain, on the other hand, is another part of the URL structure that goes before the domain name. As its main purpose is for site organization, your website can work fine without it. For instance, you can set your website address as http://website.com.
Technically, www is the most common subdomain in a fully-qualified domain name. However, it doesn’t work like other subdomains – site owners don’t use it to store content on a separate website section.
What Is the Difference Between a Subdomain and a Subdirectory
The subdirectory is a part of the website hierarchy below the root domain. Similar to a subdomain, a subdirectory helps organize content on a website. However, a subdirectory uses a folder to contain the content within the root domain. In contrast, a subdomain acts as another website that can use a different content management system (CMS) or interface.
A subdirectory and subdomain are also different regarding the URL structure as the subdirectory comes after the domain name. For example, a blog in website.com/blog means the content is organized in the blog folder inside the website.com root domain.
Another difference between a subdomain and a subdirectory is the possible nested structure for your site.
You can create nested and complicated structures using a subdirectory in the same root domain, such as website.com/blog/category and then website.com/blog/category/wordpress. Meanwhile, a subdomain has only one level of structure, such as blog.website.com.
When Should You Use a Subdomain and a Subdirectory
Ideally, you should use subdomains for separating extensive content or a web page that is too distinct from the main website. The content may need a specific content management system or a different design for the main site. For example, Hostinger’s support page is located in a subdomain as it has unique content and a different purpose than the main site.
On the other hand, we recommend using subdirectories for relevant content to the main site, so visitors can easily pass through the site structure. For example, if the main site is www.website.com, it’s ideal to place the product page on www.website.com/products.
Subdomains vs Subdirectories for SEO
The impact of subdomains and subdirectories on search engine optimization (SEO) is still debatable. While Google claims that the subdomain won’t hurt your site’s rank, the search engine sees it as a separate entity.
As a result, if you optimize both sites for the same keyword or niche, they may start competing.
The main website also doesn’t pass the link authority to the subdomain and vice versa. Therefore, if your subdomain site receives a lot of backlinks, the authority and positive SEO impact won’t benefit the primary domain.
That’s why a subdomain is more suitable for a site with a different purpose than the main one.
On the other hand, Google sees a subdirectory as part of the main site and passes authority and links, which can positively affect SEO for the primary domain name.
For this reason, we recommend using a subdirectory instead of a subdomain if you have quality content related to the main website. This is especially important for a blog that ranks well and attracts valuable traffic to build authority in your niche.
How to Create a Subdomain
There are two ways of creating a subdomain – via your control panel or the DNS settings on your hosting account. Remember that you need to buy a domain name first to create subdomains.
In this section, you’ll find the step-by-step process of creating a subdomain using both methods.
1. Create a Subdomain via hPanel
Before creating any subdomain via hPanel, ensure that your domain points to Hostinger nameservers. Once done, follow these steps:
- Go to your hPanel dashboard and navigate to Domains → Subdomains from the left sidebar.
- Enter your intended subdomain and click Create. You can tick on the Custom folder for subdomain box if you want to create a specific custom directory.
- Once done, you’ll get a Subdomain created successfully pop-up message on the upper right corner of the screen. The List of Current Subdomains section will appear on the panel to check or delete the subdomain’s information.
Important! Creating a subdomain adds an entry to your DNS zone that can take up to 24 hours for the new subdomain to start working.
Now, you must install the platform you want to use in your subdomain. For this tutorial, we’ll install WordPress using hPanel’s auto installer.
- Navigate to the Website → Auto Installer from the left sidebar.
- Click Select on the WordPress box as the platform for your subdomain.
- Open the Advanced drop-down on the installation pop-up. On the installation path, choose the URL with the new subdomain.
- Once you’ve filled out the form, click Install. This may take a few minutes, and your subdomain should be on the installed applications list on the auto-installer panel.
2. Create a Subdomain via DNS Zone Editor
If you register your domain with Hostinger, you can create a subdomain via the DNS zone editor. Here are the steps to do so:
- Go to your hPanel dashboard and navigate to Advanced → DNS Zone Editor from the sidebar.
- Fill in all fields in the Manage DNS records section to add a new record. Using the drop-down menu, select A for the Type field.
- Fill the Name field with the subdomain name you want. For example, type gallery to create the URL gallery.website.com.
- Fill in the Points to field with your hosting account’s IP address. You can see your IP address in the Hosting → Details section.
- The TTL (Time to Live) field tells the DNS resolver how long to cache information before requesting a new one. Use the default value of 14,400 seconds.
- Once completed, click Add Record, and you should see the subdomain listed right below the Manage DNS records field.
After creating a subdomain via your DNS zone, it’ll take up to 24 hours for the changes to take effect for the subdomain to work.
To keep your subdomains organized, create a subfolder in your domain’s /public_html folder via your File Manager.
To create and delete subdomains on cPanel, access your cPanel account and click on Subdomains. Next, choose a domain for your new subdomain and specify the custom directory. After creating the subdomain, you can check its information, remove it, or create a redirect, in the Modify a Subdomain section.
Subdomains help you organize content better by creating separate sites. On top of that, you can use them as a test environment or publish content in different languages to improve your site’s accessibility.
To create a website in a subdomain, ensure your hosting plan supports subdomains. Then, do so by using the control panel or the DNS zone editor.
Keep in mind that subdomains and subdirectories are different, and you should pick one that aligns with your site’s goal.
What Are Subdomains FAQ
Here are some of the frequently asked questions on what subdomains are.
Are Subdomains Free?
You don’t have to pay for subdomains if you already have a domain name. However, you may have to pay extra for a hosting plan that includes subdomains. At Hostinger, we provide subdomains on every hosting plan.
What Is an Example of a Subdomain?
Blog.website.com is a common subdomain example. In this case, blog is the subdomain, and website is the main domain. At Hostinger, we use a subdomain for our support page with the support.hostinger.com URL.
Are Subdomains Necessary?
In short, no. However, subdomains provide a way of organizing website content and creating a unique URL.
How Many Subdomains Can I Have With My Domain?
You can have multiple subdomains in one domain, depending on your hosting plan. For example, our Premium Web Hosting Plan can support up to 100 different subdomains.
If you’re unsure, consult your hosting provider to find out how many subdomains you can have.