CompareHostingOnline

Home / Guides / Subdomain vs subfolder: which is better for your site?

Guide

Subdomain vs subfolder: which is better for your site?

The difference between blog.example.com and example.com/blog, how each is hosted, the SEO and technical trade-offs and which to choose.

By Muhammad Hamza, Founder & EditorUpdated Nov 30, 2026
A93.184.216.34AAAA2606:2800:…MX10 mail.example.comNSns1.example.netTXTv=spf1 -all

Short answer

A subfolder (example.com/blog) lives inside your main site. A subdomain (blog.example.com) is treated as its own site and can be hosted separately. For one brand and one set of content, a subfolder is usually simpler.

Last verified Nov 28, 2026 · How we test
At a glance
  • What is the difference between a subdomain and a subfolder?A subdomain is a prefix added to your domain, such as blog.example.com or shop.example.com.
  • How do they compare?
  • Which is better for SEO?Neither is automatically better.

What is the difference between a subdomain and a subfolder?

A subdomain is a prefix added to your domain, such as blog.example.com or shop.example.com. You create it with a DNS record and no extra registration fee. A subfolder, also called a subdirectory, is a path on the same domain, such as example.com/blog or example.com/shop. It exists inside your main site, served by the same web server and application.

To a visitor the two look similar, but they behave differently for hosting, certificates, analytics and search engines.

How do they compare?

SubfolderSubdomain
Where it is hostedSame site and serverCan be a different server or platform
DNSNo extra recordNeeds its own record
SSL certificateCovered by the main certificateNeeds coverage: a wildcard or its own certificate
Search enginesPart of the main siteOften treated as a separate site
ManagementOne CMS and one codebaseCan be a separate app and team
Best forContent belonging to the same brandA different application or platform

Which is better for SEO?

Neither is automatically better. Search engines can crawl and rank both. Google has said it treats subdomains and subfolders fairly, but a subdomain often behaves like a separate site, so signals earned by the main site do not automatically carry to it. When the content is part of the same offering, such as a blog that supports your product pages, keeping it in a subfolder lets the whole site benefit from links and authority in one place. Where content is truly separate, such as a help centre or an app, a subdomain is fine.

The more important factor is quality and structure, not the URL pattern; see Google’s guidance on creating helpful content.

When should you use a subfolder?

  • A blog, a resource centre or documentation that supports your main site.
  • Language or region sections of one site.
  • Anything you want to rank as part of the main site.
  • A small team that wants one CMS and one deployment.

When should you use a subdomain?

  • A web application, a customer portal or a help desk on a different platform.
  • A shop that runs on a hosted ecommerce service.
  • A staging or test environment, such as staging.example.com; see what a staging site is.
  • Services that must run on separate servers or under separate security rules.

How do you set up each?

Our guides on DNS records and how to point a domain to your hosting show the records in detail.

  1. Subfolder in WordPress or a CMS

    Create the section in the application, or install the software in a folder.

  2. Subdomain in DNS

    Add an A record or CNAME for the prefix, pointing to the server or service.

  3. Add the site in the control panel

    Tell the host which folder serves the subdomain.

  4. Cover it with HTTPS

    Issue a certificate that includes the subdomain; see what an SSL certificate is.

Can you serve a subfolder from a different server?

Yes, with a reverse proxy. A proxy or CDN rule forwards requests for example.com/shop to another server while the visitor stays on the same domain. It combines the SEO benefit of a subfolder with separate hosting, but it adds configuration and a point of failure. It is a good fit for teams that must run parts of a site on different platforms. A CDN or reverse proxy such as Cloudflare can do this.

What are the common mistakes?

  • Moving a working blog from a subdomain to a subfolder without redirects, which loses traffic.
  • Forgetting that a subdomain needs its own certificate coverage and analytics view.
  • Creating many subdomains for content that belongs together.
  • Using a wildcard DNS record that makes any typed subdomain resolve.
  • Choosing by a SEO rumour instead of by how the site is built.

A worked example: a company with a blog, a shop and an app

A software company has a marketing site, a blog, an online store for merchandise and a customer web app. The blog supports the product pages and should build the main site’s authority, so it goes in a subfolder: example.com/blog. The store runs on a hosted ecommerce platform that requires its own address, so it goes on a subdomain: shop.example.com, with a CNAME pointing to the platform. The app runs on separate servers with its own login and release schedule, so app.example.com points to them with an A record.

Each piece sits where its technology and audience fit. If the company later moved the shop onto the main platform, it could bring it into example.com/shop with redirects from the old address.

How do you migrate between the two without losing traffic?

  1. Map every old URL to a new one

    Make a complete list, including images and feeds.

  2. Set 301 redirects

    Redirect each old URL to its exact new equivalent, not just the home page.

  3. Update internal links and the sitemap

    Remove references to the old address.

  4. Watch search console

    Check crawl errors and indexing for several weeks.

Sources and further reading

Common questions

Is a subdomain or a subfolder better for SEO?

Neither is automatically better. A subfolder keeps content as part of the main site, so authority builds in one place. A subdomain is often treated as a separate site, which suits separate applications. Content quality and structure matter more.

Can a subdomain be hosted on a different server?

Yes. Point its DNS record to another server or service. That is the main technical advantage, and it is why shops and help centres often use subdomains.

Does a subdomain need its own SSL certificate?

It needs a certificate that covers its name, either its own or a wildcard certificate for the domain. Most hosts and CDNs issue these automatically once DNS points to them.

Can I move a blog from a subdomain to a subfolder?

Yes, but plan it. Move the content, set 301 redirects from every old URL to the new one, update internal links and the sitemap, and watch search console for errors in the weeks after.

Do subdomains cost extra?

Not usually. You create them with DNS records on a domain you already own. You may pay for hosting or certificates if the subdomain runs a separate service.

Related

More guides

Esc

Use the arrow keys, then Enter.