A subdomain is a URL that allows you to essentially create several websites on a single domain. It’s the blog.yourcompany.com kind of URL.
Subdirectories, on the other hand, are URLs that host subsets of content in separate “folders.” It’s the yourcompany.com/blog kind of URL.
What are your preferred approach to organize website content and rank higher in search results?
Latest comments (23)
subdirectory (path), because:
subdomains should only be used when you explicitly need to break one of these, such as:
youtu.be/<id>andt.me/<id>are fun yay (and they usually can be statelessly redirected at edge, let alone have content themselves, so they don't participate in a lot of the drawbacks)Thanks for the input 🙏❤
good question... I think it depends on your preference.
If it's something out of context for the main domain, let's say missionToMars - I would choose to be a subdomain missionToMars.dev.to.
Does that make sense ? 😬
If the project will trigger CORS when on a subdomain, subdirectories. For static files, a subdomain with proper caching and no cookies.
I feel that users do not like subdomains.
My impression is that people prefer to read example.com or example.com/blog rather than blog.example.com. I could be wrong about this. Maybe subdomains are fashionable again.
Were they ever fashionable? I dunno. Worth mentioning because trends do make a difference.
From the perspective of running a website though, there are considerable advantages to using subdomains. For starters you don’t have all your eggs in one basket, so to speak. One part of your infrastructure can go down, but the rest is still up.
The downside though is that it’s more difficult to manage many different servers rather than one big website with lots of folders.
As your infra grows I feel it’s likely there will be a time when you just have to add something to a subdomain because a particular tech won’t fit into your one big website. The only way at that stage around subdomains is to just have more entirely different domains (i.e. facebook.com and instagram.com).
The hard part there is to find lots of cool sounding domains at a good price.
I've had so many problems with subpath in the past that I always end up using subdomains. If we really are talking about separate applications of course. To create these applications we use underlying web systems such as localStorage, sessionStorage or cookies that all expect a specific domain. If you use a subpath, you are sharing data between application and potentially losing bandwidth for transmitting information an application don't care at all. Because of this and server configuration reasons, I tend to avoid subpath if possible.
For me it depends on if it's a microfrontend architecture. Or if I'm hosting separate projects with one branded url :). My main site could be me.com, where my music might be music.me.com. In short, I use a subdomain when I am routing to a separate "server"
Now I use subfolders, before it was subdomains, and I can say that after moving to subfolders my real estate pages starts be better indexing. The effect was not only for that page but for others as well. Hope that helps
For me subdomains lead to a better organisation of code (has also caused duplication in some cases).
I use "subfolders" for SEO purposes, giving some structure to the project that is predictable.
Subdomains when possible, it allows separate resources from your main site/app
I use a combination of the two. My main website has several subdirectories for things like my publications, research, teaching, etc, some of those with their own subdirectories. But then I use subdomains for websites for software projects such as hosting API documentation, such as chips-n-salsa.cicirello.org/ and jpt.cicirello.org/ . For the part of your question concerning ranking, I'm not sure. I didn't organize it that way for SEO purposes. I did it more for convenience. I suspect that it might not matter as much to SEO as some believe. I base this on Google's search console, which seems to treat everything within the domain as a single entity.