# 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.

Source: https://comparehostingonline.com/guides/subdomain-vs-subfolder/

## 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](https://comparehostingonline.com/methodology/)

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?

|  | Subfolder | Subdomain |
| --- | --- | --- |
| Where it is hosted | Same site and server | Can be a different server or platform |
| DNS | No extra record | Needs its own record |
| SSL certificate | Covered by the main certificate | Needs coverage: a wildcard or its own certificate |
| Search engines | Part of the main site | Often treated as a separate site |
| Management | One CMS and one codebase | Can be a separate app and team |
| Best for | Content belonging to the same brand | A 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](https://comparehostingonline.com/guides/what-is-a-staging-site/).
-   Services that must run on separate servers or under separate security rules.

## How do you set up each?

Our guides on [DNS records](https://comparehostingonline.com/guides/what-are-dns-records/) and [how to point a domain to your hosting](https://comparehostingonline.com/guides/point-domain-to-hosting/) show the records in detail.

1.  1
    
    **Subfolder in WordPress or a CMS**
    
    Create the section in the application, or install the software in a folder.
    
2.  2
    
    **Subdomain in DNS**
    
    Add an A record or CNAME for the prefix, pointing to the server or service.
    
3.  3
    
    **Add the site in the control panel**
    
    Tell the host which folder serves the subdomain.
    
4.  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](https://comparehostingonline.com/guides/what-is-a-cdn/) 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.  1
    
    **Map every old URL to a new one**
    
    Make a complete list, including images and feeds.
    
2.  2
    
    **Set 301 redirects**
    
    Redirect each old URL to its exact new equivalent, not just the home page.
    
3.  3
    
    **Update internal links and the sitemap**
    
    Remove references to the old address.
    
4.  4
    
    **Watch search console**
    
    Check crawl errors and indexing for several weeks.
    

## Sources and further reading

-   [Google: creating helpful, reliable, people-first content](https://developers.google.com/search/docs/fundamentals/creating-helpful-content)
-   [MDN: What is a domain name?](https://developer.mozilla.org/en-US/docs/Learn_web_development/Howto/Web_mechanics/What_is_a_domain_name)
-   [Let’s Encrypt: FAQ](https://letsencrypt.org/docs/faq/)

## 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

[What is a domain name?](https://comparehostingonline.com/guides/what-is-a-domain-name/) [What are DNS records?](https://comparehostingonline.com/guides/what-are-dns-records/) [Point a domain to hosting](https://comparehostingonline.com/guides/point-domain-to-hosting/)

## More guides

[How to test a host's support before you buy](https://comparehostingonline.com/guides/test-hosting-support-before-buying/) [How to transfer a domain name to a new registrar](https://comparehostingonline.com/guides/transfer-a-domain-name/) [Website migration checklist: move to a new host with little or no downtime](https://comparehostingonline.com/guides/website-migration-checklist/) [What are inodes in web hosting? Limits, causes and how to reduce them](https://comparehostingonline.com/guides/what-are-inodes-in-hosting/) [What is a dedicated IP address and do you need one?](https://comparehostingonline.com/guides/what-is-a-dedicated-ip/) [What is a staging site? How to test changes safely before going live](https://comparehostingonline.com/guides/what-is-a-staging-site/)

MH

**[Muhammad Hamza](https://comparehostingonline.com/team/muhammad-hamza/)** Founder & Editor

Writes and signs off every comparison, and runs the compliance reviews. Has worked on SOC 2 and HIPAA compliance programs for companies.

Our [editorial policy](https://comparehostingonline.com/editorial-policy/) and [testing method](https://comparehostingonline.com/methodology/) are public.
