A subdomain is a separate name in front of your domain, such as blog.example.com, while a subdirectory is a folder within it, such as example.com/blog. A subdirectory keeps everything on one site and one host, which is simpler for most content. A subdomain suits sections that are genuinely separate, such as an app, a store on a different platform, or content that needs its own server.
Google does not say that either option ranks better. The right choice depends on how your site is built and managed. This guide explains how each works, what changes technically, and how to decide.
Key takeaways
- Subdirectory: example.com/blog. One site, one host, simplest to manage.
- Subdomain: blog.example.com. Can run on a different server or platform.
- Google does not say either ranks better. Choose for practical reasons.
- Subdomains need DNS records and certificate coverage.
- Cookies, analytics and Search Console treat subdomains differently from folders.
What is the difference?

| Subdomain (blog.example.com) | Subdirectory (example.com/blog) | |
|---|---|---|
| What it is | A separate hostname under your domain | A path on the same site |
| DNS | Needs its own record | No extra record |
| Server | Can be different | Usually the same |
| SSL certificate | Must cover the subdomain | Covered by the main certificate |
| Cookies | Shared only if set for the parent domain | Shared by default |
| Typical uses | Apps, help centres, stores on other platforms, regional sites | Blogs, guides, product pages, language versions |
What Google says
Google’s documentation on multi-regional sites lists the trade-offs of each structure. For subdomains, its pros are that they are easy to set up, allow different server locations and make it easy to separate sites. For subdirectories, its pros are that they are easy to set up and low maintenance because they share the same host, while its cons include a single server location and harder separation of sites.
The documentation does not say that one structure ranks better than the other. In practice, the decision is about how your site is built, hosted and managed. Whatever you choose, keep the structure consistent, link the sections together clearly, and avoid moving between structures without a good reason.

The technical differences
DNS
A subdomain needs its own DNS record, usually an A record pointing to a server or a CNAME pointing to a service. A subdirectory needs nothing extra, because it lives on the same host as the main site. Our guide to nameservers and A records explains these records.
SSL certificates
Each subdomain must be covered by a certificate. A wildcard certificate for *.example.com can cover many subdomains, but RFC 6125 explains that it matches only one level: it covers foo.example.com, but not bar.foo.example.com or example.com itself. A subdirectory is simply covered by the main domain’s certificate. If a subdomain shows a security warning, see our guide to fixing “Not secure” warnings.
Cookies and logins
Cookies behave differently across subdomains. MDN Web Docs explains that if a cookie does not specify a Domain attribute, it is available on the server that set it but not on its subdomains, while specifying the Domain makes it available to subdomains too. This affects shared logins, shopping baskets and some analytics set-ups.

Search Console and analytics
Google Search Console’s Domain property includes all subdomains and protocols, while a URL-prefix property covers only addresses that begin with its exact prefix and leaves out subdomains. If you use subdomains, a Domain property gives you the whole picture. Many analytics tools also need extra settings to track visitors across subdomains as a single site.
Hosting
A subdomain can live on a different server, platform or provider, which is its main practical advantage. A subdirectory usually has to run on the same server as the main site, or be routed there through a reverse proxy. For example, a subdomain for images can be served separately from the main site.
Which should you use?

| What you are adding | Usually best | Why |
|---|---|---|
| A blog on the same platform | Subdirectory | One site, one host, one set of settings |
| A web app or customer dashboard | Subdomain | Often a different system and server |
| A store on a hosted shop platform | Subdomain | Hosted shop platforms commonly connect through a subdomain |
| A help centre run by a support tool | Subdomain | Easy to point a CNAME at the provider |
| Language or country versions | Either | Subdirectories are lower maintenance; subdomains allow separate servers |
| A test or staging copy | Subdomain | Keeps it apart from the live site |
Staging copies are often hosted on a subdomain, and our guide to creating a WordPress staging site covers the options. Keep test copies out of search results.
Moving between the two
Changing structure is a site move. Map every old address to its new one, use permanent 301 redirects, update internal links and sitemaps, and check that the new location has a valid certificate. Our guide to 301 and 302 redirects explains the redirect side.
Common mistakes
- Choosing a subdomain only because of SEO advice you heard. Google’s documentation does not favour either.
- Forgetting the certificate. A new subdomain without coverage shows a security warning.
- Expecting logins to work across subdomains automatically. Cookies may need the parent domain set.
- Using a URL-prefix property in Search Console and missing subdomain data.
- Leaving a staging subdomain open to search engines. Protect it with a password or noindex.
Frequently asked questions
Is a subdomain or subdirectory better for SEO?
Google’s documentation does not say either ranks better. Choose based on how the content is built and managed, and keep it well linked to your main site.
Is www a subdomain?
Technically, yes. Most sites treat www and the bare domain as the same site and redirect one to the other.
Do subdomains need their own SSL certificate?
They need to be covered by a certificate, which can be a separate one, a multi-name certificate or a wildcard that covers one level of subdomains.
Can a subdomain be on a different host?
Yes. Point its DNS record at the other server or service.
Should my blog be on a subdomain?
If it runs on the same platform as your site, a subdirectory is usually simpler. Use a subdomain if the blog runs on a separate system.
How many subdomains can I have?
DNS allows many. Your hosting plan or DNS provider may set its own limits.
The short version
Use a subdirectory when new content lives on the same platform as your site, because it is one site to host, secure and manage. Use a subdomain when the content needs its own system, server or provider, and remember that it needs its own DNS record, certificate coverage and attention to cookies and analytics. For the basics of hosting, see what web hosting is.
Justwebworld has published guides since 2012. How we write and update articles Report an error