Skip to content
Enjoy 20% off for 12 months on all plans. Use promo code: HYPERGROWTHClaim it

Crawling and indexing

What is a subdomain, and is it better than a subfolder for SEO?

A subdomain is a name added in front of your domain, such as blog.example.com or shop.example.com, that can run as its own website on its own server.

One domain, four addresses

  1. 1example.com: the main site
  2. 2www.example.com: a subdomain, usually redirected to one version
  3. 3shop.example.com: a store on a different platform
  4. 4example.com/blog: a subfolder on the main site's host

The two subdomains each answer their own robots.txt. The subfolder shares example.com's.

How a subdomain works

You create a subdomain with a DNS record for a domain you already own, and that record can point to a different server from your main site. That's why a shop, a help centre or a blog run by another company's software often sits on one: help.example.com can be served by a help-desk tool while example.com runs on your CMS. www is a subdomain too.

Subdomain or subfolder for SEO?

Google's documentation doesn't say one ranks better. What it documents is how they're handled. A robots.txt file only applies to the host it sits on, so blog.example.com needs its own. In Search Console, a URL-prefix property covers one host, while a Domain property covers every subdomain. Google's guide to multi-regional sites lists subdomains as easy to set up and able to run on different servers, and subfolders as easy to set up and low maintenance because they share one host.

In practice, a subfolder such as example.com/blog is the simpler choice when the content runs on the same platform as the main site. A subdomain earns its place when it has to run on a different system.

What each subdomain needs

If you do use one, set it up like a site of its own:

  • Its own robots.txt at its root.
  • A sitemap of its pages, submitted in Search Console.
  • A Domain property in Search Console, or a URL-prefix property for each subdomain.
  • Links from the main site to it, and back, so Google finds it.

SEO glossary

Every term starts with a one-sentence answer and links the free tool or lesson that helps next.

All terms

Subdomain: questions people ask

What is a subdomain example?

blog.example.com, shop.example.com and www.example.com are all subdomains of example.com.

What is the difference between a subdomain and a domain?

The domain is the name you register, such as example.com. A subdomain is a name you create under it, such as help.example.com, with a DNS record and no new registration.

Does a subdomain need its own robots.txt?

Yes. Google applies a robots.txt file only to the host it sits on, so example.com/robots.txt doesn't cover shop.example.com.

See which searches your own site should answer next.

Start with the plan for your own site: which page targets each search, and what to write next. The first one is free.

  • Free first plan
  • No credit card
  • Keep your plan