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