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 aliceblogs.com and Bob scooped up bobtopia.com.
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 blog.bobtopia.com – a subdomain of bobtopia.com. Alice keeps it old school and builds hers at aliceblogs.com/blog – a subdirectory of aliceblogs.com.
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 oldschoolsite.com/blog 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 aliceblogs.com/blog – 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 aliceblogs.com/blog to her hosted blog. It takes time, patience, and experience to connect her domain to her hosted blog.
Bob'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.
To 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, blog.bobtopia.com is more appealing than bobtopia.com/blog. 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 bobtopia.com is already a popular online platform for folks named Bob to seek kinship with other Bobs. In this peculiar world, searches that rank for bobtopia.com wouldn't automatically rank for blog.bobtopia.com 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.
Subdomains 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 blog.bobtopia.com does not help bobtopia.com 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 bobtopia.com and Bobs everywhere would rejoice.
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 bobtopia.com 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 deutsch.bobtopia.com. 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 docs.disruptivepaas.com and blog.disruptivepaas.com. Why not switch to disruptivepaas.com/docs and disruptivepaas.com/blog 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.
Interested in deploying a Cloudflare Worker without setting up a domain on Cloudflare? We’re making it easier to get started building serverless applications with custom subdomains on workers.dev. If you’re already a Cloudflare customer, you can add Workers to your existing website here.