logo
Parslinks
Back to blog
Guides5 min read

Subdomain or subfolder for your blog and app docs?

blog.example.com or example.com/blog? A decision you make once, and one that's expensive to change later.

Alireza Tadi

Co-founder, Parslinks · Team, marketing & infrastructure

An online spice and dried-fruit shop in Kerman decides, after two years, to start a blog: saffron recipes, a guide to choosing pistachios, and articles meant to show up in searches for dishes like sholeh zard. The tech team installs WordPress on blog.example.ir because it's easiest. A year later the blog gets good traffic, but the shop's product pages haven't moved in the rankings. The SEO consultant asks: "Why isn't the blog in a subfolder?"

Two choices, one main difference

Search engines treat a subdomain partly as a separate site. Links to articles on blog.example.ir don't pass their full authority to example.ir. In a subfolder (example.ir/blog) all the authority builds up on one domain, and a popular article helps the product pages too.

Google officially says it indexes both well, and that's true. But the practical experience of most SEO specialists, especially for small and medium sites, favours subfolders.

A blog on a subdomain compared with a subfolder

When a subdomain makes sense

  • The main app, separate from the site: app.example.com for the dashboard. Pages behind login aren't meant to be indexed, so SEO doesn't matter.
  • A completely different audience: careers.example.com, say, or a sub-brand's site.
  • A real technical constraint: when the blog or docs tool genuinely can't run under a path and a proxy isn't possible.

When a subfolder is better

  • Blogs and educational content meant to attract search traffic and lift the whole site.
  • Product docs that users move between and the site.
  • Multilingual pages: example.com/en instead of en.example.com, with correct hreflang tags.

A subfolder without merging projects

A common worry is that a subfolder means the blog and site must be one project. They don't. The blog can be deployed separately while the main site proxies /blog to it. In Next.js:

next.config.mjs
// Main site; the blog is deployed separately at another address
export default {
  async rewrites() {
    return [
      { source: "/blog", destination: "https://blog-origin.example.com/blog" },
      { source: "/blog/:path*", destination: "https://blog-origin.example.com/blog/:path*" },
    ];
  },
};
ts9 lines

The blog must know it's served under /blog: in WordPress, set the site URL to https://example.com/blog; in Next.js, use basePath: "/blog". And mark the blog's origin address (blog-origin) noindex so it doesn't create duplicate content.

If you're on a subdomain today

Migrating is worth it if the blog has meaningful traffic and you want it to help the main site. The order:

  1. Make the blog available under /blog on the main site (proxy or move it).
  2. Add 301 redirects from every blog.example.com/* URL to example.com/blog/*.
  3. Point every article's canonical at the new URL.
  4. In Search Console, register the change of address and submit the new sitemap.
  5. A few weeks of ranking wobble is normal; keep the redirects for at least a year.

The Kerman shop did exactly this. A few months later, the product page for their premium pistachios, linked from their most popular articles, reached the first page of results for the first time.

Frequently asked questions

Join the discussion

No comments yet. Be the first to share your thoughts.