What is a subdomain? A guide to creating and using subdomains

What is a subdomain? A guide to creating and using subdomains

A subdomain is a subset of a primary domain. It’s used to create separate sections of a website, without cluttering its main purposes.

In the URL structure, a subdomain is represented by a prefix added before the root domain. For example, in support.hostinger.com, support is the subdomain of hostinger.com.

So why do you need a subdomain in the first place? How can you create one? Keep reading, as this guide will answer every question you might have about subdomains.

What is a subdomain used for?

A subdomain is mainly used to organize website sections with different purposes.

Say you run a blog, and you want to start selling brand merchandise. In that case, you can create an eCommerce store and place it in a separate subdomain, like shop.example.com.

By doing so, your main website remains organized and focused. Readers will be able to read your helpful content without feeling like they’re being sold to.

Plus, search engines like Google treat subdomains as separate entities from your main website.

This means you have the freedom to use a different content management system (CMS), create a unique design, or integrate functionality not available on your main website.

So, if your main website runs on WordPress, you can easily use a dedicated eCommerce platform to manage your online store separately.

It’s also a common practice to add multiple subdomains for different versions of your site.

For instance, you can create a subdomain like uk.website.com to serve the British audience.

Beyond content organization, many developers use subdomains as a staging environment to test new features before publishing them on the live site.

Benefits of using subdomains for your website

A subdomain is entirely optional – your site works just fine without it. But when used properly, creating subdomains brings many benefits.

Organize different areas of your website

As your business grows, creating subdomains helps expand your products or services without cluttering your website’s main offerings.

Google is a great example. The search engine now has multiple products under its belt, including Google Docs, Google Store, and Google Ads.

To keep the main domain, google.com, solely for search-related purposes, Google registers multiple subdomains like:

  • docs.google.com
  • store.google.com
  • ads.google.com

Target specific niches or audiences more effectively

Your business may have multiple products that target specific audiences. With subdomains, you can create separate sites to serve different types of users.

For instance, game developers usually create a forum subdomain for players to hang out and discuss the game, like forum.terraria.org.

Amazon uses affiliate-program.amazon.com for its affiliate program, since it mostly targets affiliate marketers and content creators. Both aren’t typical Amazon Marketplace customers.

Moreover, if you want to create websites for different regions, you can register subdomains for each locale.

Wikipedia uses en.wikipedia.org to serve English-speaking users, de.wikipedia.org for the German market, and so on.

Deliver a better user experience

Subdomains make it easier for users to find specific information or sections.

When readers want to read blog posts from Hubspot, they can open blog.hubspot.com directly from the browser. There’s no need to visit the homepage and locate the blog section.

The same goes for creating a new document on Google Docs, which anyone can do easily by accessing docs.google.com.

Subdomain vs. subdirectory: Which one you should use

Both subdomains and subdirectories help organize your website content. But these two have key differences:

  • Subdirectory. A folder that contains specific content inside a root domain.
  • Subdomain. A whole separate website with its own interface and content structure, but still part of the main domain.

A subdirectory always comes after the primary domain name, like example.com/blog. It means the content is organized in the blog folder inside the example.com root domain.

You can also create a nested and complicated path using a subdirectory in the same root domain, such as example.com/blog/topic.

Meanwhile, a subdomain always comes before the root domain and usually has one level of structure, like blog.website.com.

Technically, you can register multi-level subdomains like uk.blog.example.com, but such practice is rare. Most websites prefer to register a country-code top-level domain (TLD) instead for localized content.

Here’s what a complete URL structure looks like to help you understand the difference between a subdomain and a subdirectory or path:

Which one you should use for search engine optimization depends on your goals.

Google considers subdomains as separate entities from the primary domain names. In other words, your main website won’t pass the link juice to the subdomain and vice versa.

So if your subdomain site is performing well, the authority and positive SEO impact won’t benefit the primary domain.

That’s why a subdomain is more suitable for separating a web page that serves a different purpose than the main site.

For instance, our help center page is located in a subdomain because its purpose is to help our existing customers, not to rank in search results.

On the other hand, Google sees a subdirectory as part of the main website. The subdirectory page will pass authority and links to the primary domain name, helping it rank better.

For this reason, we recommend using subdirectories to add relevant sections to your main website.

If you run an online store, it makes sense to place the product page in a subdirectory like www.website.com/products instead of a subdomain like product.website.com.

How to create a subdomain: Step-by-step Instructions

First of all, you need a hosting plan that supports subdomains.

Hostinger’s web hosting plans offer up to 100 subdomains, while the cloud hosting solutions provide up to 300 subdomains.

Hostinger web hosting banner

Once you’ve bought a plan, you register a new domain name via hPanel.

If you already have one from another domain registrar, make sure to point your main domain to Hostinger nameservers.

After that, follow these steps to set up a subdomain:

  1. Log in to your hPanel dashboard, navigate to Websites, and click Dashboard next to your domain name.
  1. Go to DomainsSubdomains from the left sidebar.
  2. Enter your intended subdomain and tick the Custom folder for subdomain box if you want to create a separate directory for your subdomain.
  1. Click Create, and that’s it – your new subdomain will appear under the List of Current Subdomains section. 

Note that you may have to wait up to 24 hours for the DNS updates to finish before your subdomain starts working.

Next, install the platform you want to use in your subdomain. For this tutorial, we’ll install WordPress using hPanel’s auto installer:

  1. Access WordPressOverview from the left menu.
  2. Choose your new subdomain from the dropdown menu on the top right side of your screen.
  3. Install the latest version of WordPress to your subdomain.
  1. Fill in new website credentials for your subdomain. Open the Advanced drop-down to select the installation path and create a new database.
  1. Once you’ve filled out the form, click Next. Here, you can choose your preferred WordPress version, language, or PHP version and update your schedule.
  2. Click Install, and you’re good to go.

If you’re using cPanel, check out its official documentation on how to create and manage subdomains.

Common mistakes to avoid with subdomains

Here are some common mistakes site owners make when creating subdomains and tips on how you can avoid them:

Not having a clear strategy

Creating subdomains just for the sake of creating won’t do any good for your SEO efforts.

Remember, subdomains don’t pass link juice to the root domain. Also, having a bunch of irrelevant subdomains could potentially dilute the authority of your primary website.

Before you create a subdomain, ask yourself whether it’s truly necessary. Perhaps it’s better to use a subdirectory instead?

Targeting the same keywords

Keyword cannibalization occurs when two or more pages on your website are competing for the same keyword. This can confuse search engines and might result in lower rankings for each page.

As mentioned before, Google treats subdomains as separate sites. If your subdomain targets the same keyword or has similar content as your main domain, it could spell disaster.

So, whenever you create a new subdomain, make sure it answers a totally different intent from any pages on your primary domain.

In case you want to move old pages on your root domain to new subdomains, always perform a domain redirection to preserve link equity and ranking power.

Not setting up Search Console properly

When adding your website to Google Search Console (GSC), you will see two property types: Domain and URL prefix.

If you choose the URL prefix, you will have to enter the full URL of your site, such as https://example.com.

The problem with this method is that GSC will only track https://example.com and its subdirectories, such as https://example.com/blog/category. A subdomain like https://support.example.com is excluded.

To track both your domain and subdomains, you need to select the Domain property.

Not linking to subdomains

Unless your subdomains are as popular as blog.hubspot.com or docs.google.com, chances are users won’t know they exist.

That’s why it’s crucial to provide internal links to your subdomains from the main website.

It helps users navigate your site and makes it easier for search engine bots to crawl all subdomain pages within your root domain.

Conclusion

Subdomains are great for keeping your website organized, especially when your site has distinct sections or different versions.

They also make for a good testing environment, where you can try new features or designs before implementing them on the live page.

However, since Google sees them as separate entities from your main domain, you need a proper strategy to make the most of subdomains.

As a rule of thumb, you can create subdomains for any sections that don’t directly relate to your site’s main offerings. These include pages for a help center, blog, online store, and affiliate program.

For relevant sections, it’s better to use subdirectories to preserve the authority and SEO power of your main domain name.

What is a subdomain FAQ

Are subdomains free?

Some hosting providers offer free subdomains as part of their services. For instance, if you buy a yearly web hosting plan from Hostinger, you will get one primary domain name and 100 subdomains free of charge for the first year.

Are subdomains necessary?

It depends on your specific needs and goals. If you want to create different types of content, products, or services from what your main website offers, adding a separate subdomain can be helpful.

For example, Google registers docs.google.com for its Google Docs product, keeping the main google.com domain exclusively for search-related purposes.

How many subdomains can I have with my domain?

The number of subdomains you can register will depend on your hosting provider and plan. At Hostinger, we offer up to 100 subdomains with our web hosting services and up to 300 subdomains with our cloud hosting packages.

Is www considered as a subdomain?

Technically, yes. Before websites were popular, URLs used www to indicate that a web address points to a web page. But today, the use of www is unnecessary, and many sites have dropped it entirely from their URL.

Author
The author

Brian Fajar Mauladhika

Brian is a Content Writer who loves telling complex stories in a simple way. He has written all types of content, including tutorials, blog posts, landing pages, social media posts, white papers, infographics, and YouTube scripts. Follow him on LinkedIn.