A subdirectory (example.com/blog) keeps everything on one host, so it shares one server, one robots.txt and one analytics setup with your main site. A subdomain (blog.example.com) is a separate host: easier to run on different software or servers, but each part needs its own setup. When nothing forces a split, the subdirectory is simpler.
| Topic | Subdirectory: example.com/blog | Subdomain: blog.example.com |
|---|---|---|
| Hosting | Same server or a proxy rule | Can point anywhere with a DNS record |
| robots.txt | One file covers it | Needs its own file |
| Cookies | Shared by default | Shared only if Domain is set on the cookie |
| Analytics | Same setup | Google recommends cross-domain setup |
| Search Console | Covered by the main property | Covered by a Domain property, or add its own |
| Google's international guide | Low maintenance, single server location | Easy setup, allows different server locations |
Updated
A subdomain is the part before your main domain name, like shop in shop.example.com. A subdirectory, also called a subfolder, is a path after it, like /shop. Both can rank, and the right pick usually depends on how your site is built and hosted. Answer the questions below for a suggestion with the reasons.
Use a subdirectory, such as example.com/blog. Nothing you said requires a separate host.
Runs in your browser. Your answers are not saved or sent.
A subdomain needs a DNS record; a subdirectory on another system needs a proxy rule on the main server.
Your shop provider tells you the exact target. This CNAME points shop.example.com at it.
shop.example.com. 3600 IN CNAME stores.provider.example.The main server fetches /blog pages from the blog's own host and serves them under your domain.
location /blog/ {
proxy_pass https://blog-backend.example.net/;
proxy_set_header Host blog-backend.example.net;
}With Domain set, the cookie is sent to example.com and to shop.example.com.
Set-Cookie: cart=abc123; Domain=example.com; Path=/; Secure; HttpOnly
To a browser and a crawler, blog.example.com is a different host from www.example.com. Google's robots.txt guide says a file only applies to the protocol, host and port where it is posted, so each subdomain needs its own. The Google Analytics help on cross-domain measurement recommends that setup for subdomains, because visits that cross cookie domains can show up as self-referrals.
A subdirectory avoids all of that, but it needs your main site to serve the path. If the blog runs on different software, that usually means a reverse proxy, a server rule that fetches pages from another system and serves them under your domain.
Moving from blog.example.com to example.com/blog is a site move for that section. Google's site move guide says to keep redirects generally at least one year, and its Change of Address tool is only for moves from one domain or subdomain to another.
Plan the redirect map before you switch: every old post address points to the matching new one.
Google's guide for multi-regional sites lists both as valid structures and describes trade-offs in setup and maintenance, not a ranking rule. We found no Google documentation that ranks one above the other.
Only if the blog has to run on a different platform or server that cannot sit behind your main domain's path. Otherwise example.com/blog keeps one robots.txt, one analytics stream and one place to manage.
Google's international guide lists country domains, subdomains and subdirectories. Subdirectories such as /de/ are easy to set up and low maintenance; subdomains allow different server locations. Either way, connect the versions with hreflang tags.
MDN explains that a cookie set without a Domain attribute stays on the host that set it, not its subdomains. Set Domain=example.com when a login or cart must carry over from the main site to shop.example.com.
Not if you verified a Domain property. Google's help says a Domain property includes data for all protocol and subdomain variations. A URL-prefix property for https://www.example.com does not include the blog subdomain.
Related: Domain vs hosting, www vs non-www, hreflang tags, Domain forwarding: 301 vs 302, Google Search Console guide.
Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.
We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.