The subdirectory strategy concentrates your keywords onto a single domain while the subdomain strategy spreads your keywords across multiple distinct domains. In a word, the subdirectory strategy results in better root domain authority.
Subdomains are extensions of domain name that you can forward to URLs or point to IP addresses and directories within the hosting account or different servers. Sub domains function separately from your main domain. We can create areas of a website by using subdomains.
What Is a Subdomain? A subdomain is very different from a subdirectory; it is like an entirely different website. The subdomain is associated with the domain, but not the website that is associated with the domain name. A subdomain is generally considered as a standalone site that is branched off from the main domain.
A subdomain is a division or alias of your domain that can be used to organize your existing website into a separate site. Typically, subdomains are used if there is content that is distinct from the rest of the site. Subdomains are indicated by the section to the left of the root URL.
Besides the fact that from a security standpoint it is a bit easier to isolate an app within a subdomain, I will just comment on what I think is the biggest difference between the two.
Pro's for subdomains:
Cons:
My advice:
Make sure you can always do both, which will give you the best of both worlds. Every part of your app should have a configurable base uri that is always respected. As long as you make sure you can always go both ways, then who cares what you do? it's just a url and it can always be changed.
document.domain
and consorts). I do not know of anything on the JavaScript side that is completely impossible when working with different sub-domains.Opinion:
I personally tend towards directories and against subdomains for public addresses. The general public have become used to web addresses beginning with "www." and it creates unnecessary confusion to break this pattern. You will notice that very often people, when given a subdomain to type into the address bar, will automatically start typing in "www." and they will be surprised to learn that an address can be without.
To me, the only good way to use subdomains is for internal purposes to facilitate, or prepare for, the use of different servers (e.g. static.example.com, images.example.com etc.)
Personally, I prefer using a subdomain for each application, and then the sub-dirs (whether they are actually sub-directories or not -- preferably they are just re-routed to /index.php
by a .htaccess) to denote different states of that application. For example:
admin.blah.com/users/1234/bob
,admin.blah.com/pages/4321/title
,blog.blah.com/archives/2007/5678/title
,
etc.
The subdomain tells you where you are, and the sub-directories tell you what you're doing.
You'd be best off recognizing that subdomains are a "major" separation in Web space, and subdirectories a "minor" one. Subdomains are for, well, different domains; you could have different people running different applications on different subdomains. Subdirectories are partitions of a single (sub)domain, separating perhaps different applications by the same user.
Web standards are intentionally very open, but the more you abuse them to create strange hierarchies, the more that will bite you in the end.
One of the major advantages of sub-domains is the files they point to can be contained anywhere -- even on another server. My most common usage of a sub-domain is on going development of a live project. For example, you could create the sub-domain:
dev.example.com
and make a copy of your live site, including the entire directory structure. Drop in an .htaccess file to refuse connections from anyone but you and your client's IP, and use this to make changes until the updates are ready to be pushed live.
There have been excellent answers already, so you could check out these links anytime.
Subdomains and subdirectories
Sub Domain Vs Sub Directory
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With