Skip to content
Have a project in mind?
The Gloria JournalWebsite management

Subdomain or subfolder: which is better for SEO?

Diagram of six numbered nodes connected by arrows

A reader once sent me a very simple question. His site sold three product categories and had a blog on it, and he wanted to know whether he could create one subdomain per product without taking a risk. The unspoken part: would it help his rankings, or hurt them? I have been publishing an answer to that question since 2018. My position has become more nuanced over the years. Google's has not moved.

Vocabulary first. example.com/blog/ is a subfolder, also called a subdirectory: same host, therefore the same site in technical terms. blog.example.com is a subdomain: a different host, which can live on a different server, with its own configuration.

The choice looks cosmetic. It is not — but not for the reasons you usually hear in a project meeting. The real differences sit in crawling, configuration and internal linking. None of them is a ranking bonus.

What Google says, and what it does not say

Google's public position has not changed in years: the two structures are treated equivalently in search. The subject produced a blunt clash with part of the industry in January 2018, when John Mueller and Danny Sullivan had to defend that line publicly. Mueller's summary still holds: there are good reasons to go either way, but you should not pick one blindly hoping for a ranking premium (Search Engine Roundtable, 24 January 2018).

On the industry side, Patrick Stox published an article at Ahrefs in March 2021 describing the SEO preference for subfolders as a myth built on old studies: in the migration cases people quote, other factors — a redesign, heavier internal linking, new content — explain the differences better than the URL structure does (Ahrefs, Subdomain vs Subfolder). Ranking is the wrong angle of attack.

The official documentation is far more concrete on crawling. Google defines a site, for its crawling infrastructure, as a single hostname: https://www.example.com/ and https://code.example.com/ are two separate sites with separate crawl budgets (Google Search Central, managing crawl budget). That is not link equity but plumbing: each host has its own queue and limits.

What a subdomain actually changes

Here is what moves when you go from a subfolder to a subdomain. No single point is a deal-breaker; added together, they are recurring configuration work.

Operational differences between a subfolder and a subdomain
Element Subfolder Subdomain
Crawling by Google Budget shared with the site Separate host, separate budget
robots.txt file One file One file per host
Search Console Covered by the site property Domain property, or a separate property
Site name in results Not handled at folder level Its own site name is possible
TLS certificate Nothing to add A certificate or a wildcard to manage
Cookies Shared by default Depends on the Domain attribute
Analytics No configuration needed Cookie domain to align

Two clarifications. A robots.txt file applies only to the host, protocol and port it is served from: the one on www.example.com does not govern shop.example.com (robots.txt documentation). And in Search Console, a URL-prefix property does not include subdomains; only a domain property, verified through DNS, covers them all (Search Console help).

One clear advantage sits on the subdomain side: Google handles site names at domain and subdomain level only, not at folder level. https://example.com/news cannot carry its own site name, https://news.example.com can (Search Central, site names). Marginal for a small business, real for a publisher running several brands.

The concrete cases, one by one

The blog

A subfolder, without hesitation. A blog exists to attract an audience you then steer towards your commercial pages, and keeping it on the same host simplifies internal linking, measurement and maintenance. I have never seen a sound argument for blog.example.com at a small or mid-sized company, unless hosting constraints force it.

The shop

Same answer, and this is where I have seen the most damage. In courses and talks I regularly showed shops parked on a subdomain beside an editorial site: the content took off over the years, the shop stayed flat. When the shop lives elsewhere, nobody links to it from the content, product pages are never cited from the home page, and the team ends up treating the two as separate projects. A subdomain can work, provided you give it the internal linking a subfolder would get for free.

Language versions

This is the one case where I no longer rule as firmly as I did. Google's documentation presents all three structures — country-code domain, subdomain, subfolder — with their advantages and drawbacks, without naming a best one; only URL parameters are advised against (URL structures for multi-regional sites). The subdomain is credited there with one strength the subfolder lacks: different servers per market.

My practical recommendation for a mid-sized company is unchanged: one main site, then subfolders by language or by market. I have seen companies that opened a site per European country come back to that model, unable to sustain decent visibility across five domains at once. The build side of that decision is covered in our notes on running a multilingual WordPress site.

The help centre or documentation

Here the subdomain has a case. Help centres often run on an external tool hosted by a vendor, hard to plug under a subfolder without a reverse proxy. The content targets a different audience — your existing customers — and is not chasing commercial queries. If your vendor offers a subfolder through a proxy, take it. Otherwise help.example.com is a fair compromise.

The staging environment

Subdomain, always, and locked down. A staging site on staging.example.com should be closed with HTTP authentication, not only with noindex or robots.txt; I have taken over enough sites whose staging copy ended up indexed to insist. If that has already happened to you, start with our guidance on getting the right pages indexed. One technical detail: if your domain is on the HSTS preload list, the entry requires the includeSubDomains directive and applies to every subdomain, including internal ones (hstspreload.org). A staging host without a valid certificate then becomes unreachable.

The technical side to anticipate

Certificates first. Each subdomain needs its own, or a wildcard for *.example.com that covers one level only. At Let's Encrypt, a wildcard requires DNS-01 validation, heavier to automate than HTTP validation, and the rate limit is 50 certificates per registered domain every 7 days (Let's Encrypt rate limits). One subdomain per product, as my reader had in mind, hits that ceiling quickly.

Cookies next. A cookie with no Domain attribute goes back only to the host that set it. Cookies prefixed with __Host-, used for sensitive sessions, forbid that attribute outright (MDN, Set-Cookie). These three lines behave very differently:

Set-Cookie: session=abc; Path=/; Secure; HttpOnly
Set-Cookie: session=abc; Domain=example.com; Path=/; Secure; HttpOnly
Set-Cookie: __Host-session=abc; Path=/; Secure; HttpOnly

The first stays on its host. The second reaches the subdomains. The third cannot be shared at all. So a basket or a session that must survive the move from www to shop needs explicit configuration.

Measurement last. Google Analytics 4 recommends configuring cross-domain measurement for subdomains and checking that they share one cookie domain, failing which self-referrals appear and sessions are cut in two (Google Analytics help). It is the error I correct most often on this kind of architecture.

What if I want to change?

Moving a subdomain into a subfolder is a standard URL migration: a page-by-page mapping plan, 301 redirects, updated internal links, a new sitemap, and monitoring in Search Console for several weeks. Our website redesign guide sets out that order of operations, and scoping an audit first is usually cheaper than repairing the mapping afterwards.

One warning about a practice suggested to me from time to time: moving questionable content onto a subdomain or a dedicated folder to isolate the risk does not work. Google's spam policies explicitly target the use or creation of subdomains, subdirectories or sites in order to keep breaking the rules (Google spam policies). The assessment is about editorial control, not location.

My decision rule

I pick a subfolder by default, and switch to a subdomain only if one of three answers is yes. Does the content run on a platform I cannot plug under a subfolder? Does it address a genuinely different audience, with no competition against my commercial pages? Does it need isolating for security or load reasons, like a staging environment or an API? If every answer is no, the subdomain brings nothing a folder would not.

So the answer to that reader fits in a sentence. One subdomain per product carries no risk in the sense of a penalty, but it multiplies the sites you have to keep alive for no benefit. Three categories sit comfortably in three folders of one site.

Common questions

Is a subdomain penalised by Google?

No. There is no penalty attached to using a subdomain, and Google has restated publicly that both structures are treated equivalently for ranking. The difference plays out in crawling, configuration and internal linking, not in a sanction.

Does a subdomain inherit the authority of the main domain?

Not automatically, and the question is framed badly. For Google's crawling infrastructure, a different hostname is a different site with its own crawl budget. What counts in practice is the number and quality of links pointing at those pages, internal links included.

Do I have to declare every subdomain in Search Console?

It depends on the property type. A URL-prefix property does not cover subdomains, so you need one property per subdomain. A domain property, verified with a DNS record, covers every subdomain and every protocol in one go.

Do I need a separate SSL certificate for each subdomain?

Yes, unless you use a wildcard certificate covering every subdomain at the same level. At Let's Encrypt a wildcard requires validation through a DNS record, more complex to automate than standard validation. More subdomains means more renewals to watch.

Will a subdomain affect my analytics?

Yes, if nothing is configured. Google Analytics 4 recommends enabling cross-domain measurement for subdomains and checking that they share one cookie domain. Without that, a visitor moving from the main site to the subdomain can be counted twice.

Should my help centre sit on a subdomain?

It is one of the few cases where a subdomain is justified, because these tools are often hosted by an external vendor. If your vendor lets you serve it under a subfolder through a reverse proxy, prefer that. Otherwise a subdomain, properly linked to the main site, does the job.

This link opens in a new tab.