CloudFlare Subdomain vs. Subdirectory SEO
SEO Best Practices with Cloudflare Workers, Part 1: Subdomain vs. Subdirectory

Subdomain vs. Subdirectory: 2 Different SEO Strategies

Alice and Bob are budding blogger buddies who met up at a meetup and purchased some root domains to start writing. Alice bought and Bob scooped up
Alice and Bob decided against WordPress because its what their parents use and purchased subscriptions to a popular cloud-based Ghost blogging platform instead.
Bob decides his blog should live at at a subdomain of Alice keeps it old school and builds hers at a subdirectory of

Subdomains and subdirectories are different strategies for instrumenting root domains with new features (think a blog or a storefront). Alice and Bob chose their strategies on a whim, but which strategy is technically better? The short answer is, it depends. But the long answer can actually improve your SEO. In this article, we'll review the merits and tradeoffs of each. In Part 2, we'll show you how to convert subdomains to subdirectories using Cloudflare Workers.

Setting Up Subdomains and Subdirectories

Setting up subdirectories is trivial on basic websites. A web server treats its subdirectories (aka subfolders) the same as regular old folders in a file system. In other words, basic sites are already organized using subdirectories out of the box. No set up or configuration is required.

In the old school site above, we'll assume the blog folder contains an index.html file. The web server renders blog/index.html when a user navigates to the subdirectory. But Alice and Bob's sites don't have a blog folder because their blogs are hosted remotely so this approach won't work.
On the modern Internet, subdirectory setup is more complicated because the services that comprise a root domain are often hosted on machines scattered across the world.
Because DNS records only operate on the domain level, records like CNAME have no effect on a url like and because her blog is hosted remotely, Alice needs to install NGINX or another reverse proxy and write some configuration code that proxies traffic from to her hosted blog. It takes time, patience, and experience to connect her domain to her hosted blog.

A location block in NGINX is necessary to proxy traffic from a subdirectory to a remote hostBob's subdomain strategy is the easier approach with his remotely hosted blog. A DNS CNAME record is often all that's required to connect Bob's blog to his subdomain. No additional configuration is needed if he can remember to pay his monthly subscription.

Configuring a DNS record to point a hosted service at your blog subdomainTo recap, subdirectories are already built into simple sites that serve structured content from the same machine, but modern sites often rely on various remote services. Subdomain set up is comparatively easy for sites that take advantage of various hosted cloud-based platforms.

Are Subdomains or Subdirectories Better for SEO?

Subdomains are neat. If you ask me, is more appealing than But if we want to make an informed decision about the best strategy, where do we look? If we're interested in SEO, we ought to consult the Google Bot.

Subdomains and subdirectories are equal in the eyes of the Google Bot, according to Google itself. This means that Alice and Bob have the same chance at ranking in search results. This is because Alice's root domain and Bob's subdomain build their own sets of keywords. Relevant keywords help your audience find your site in a search. There is one important caveat to point out for Bob:
A subdomain is equal and distinct from a root domain. This means that a subdomain's keywords are treated separately from the root domain.
What does this mean for Bob? Let's imagine is already a popular online platform for folks named Bob to seek kinship with other Bobs. In this peculiar world, searches that rank for wouldn't automatically rank for because each domain has its own separate keywords. The lesson here is that keywords are diluted across subdomains. Each additional subdomain decreases the likelihood that any particular domain ranks in a given search. A high ranking subdomain does not imply your root domain ranks well.

In a search for "Cool Blog", suffers from keyword dilution. It doesn't rank because its blog keyword is owned by also suffer from backlink dilution. A backlink is simply a hyperlink that points back to your site. Alice's attribution to a post on the etymology of Bob from does not help because the subdomain is treated separate but equal from the root domain. If Bob used subdirectories instead, Bob's blog posts would feed the authority of and Bobs everywhere would rejoice.

The authority of is increased when Alice links to Bob's interesting blog post, but the authority of is not affected.Although search engines have improved at identifying subdomains and attributing keywords back to the root domain, they still have a long way to go. A prudent marketer would avoid risk by assuming search engines will always be bad at cataloguing subdomains.

So when would you want to use subdomains? A good use case is for companies who are interested in expanding into foreign markets. Pretend is an American company whose website is in English. Their English keywords won't rank well in German searches so they translate their site into German to begin building new keywords on Erfolg!
Other use cases for subdomains include product stratification (think global brands with presence across many markets) and corporate internal tools (think productivity and organization tools that aren't user facing). But unless you're a huge corporation or just finished your Series C round of funding, subdomaining your site into many silos is not helping your SEO.


If you're a startup or small business looking to optimize your SEO, consider subdirectories over subdomains. Boosting the authority of your root domain should be a universal goal of any organization. The subdirectory strategy concentrates your keywords onto a single domain while the subdomain strategy spreads your keywords across multiple distinct domains. In a word, the subdirectory strategy results in better root domain authority. Higher domain authority leads to better search rankings which translates to more engagement.
Consider the multitude of disruptive PaaS startups with and Why not switch to and to boost the authority of your root domain with all those docs searches and StackOverflow backlinks?

Want to Switch Your Subdomains to Subdirectories?

Interested in switching your subdomains to subdirectories without a reverse proxy? In Part 2, we'll show you how using Cloudflare Workers.