Sub-Directory or Sub-Domain?
Last Updated: June 22, 2015
If you have a new section of content to add to your website, there are two methods you can use to add this section: sub-domain or sub-directory. Which method is best?
Before diving into which method is best, let’s quickly define what each is:
A sub-directory (or sub-folder) is part of your main domain. In the case of this website, the main domain is matthewedgar.net. A sub-directory for my blog may look like matthewedgar.net/blog, where “blog” is the name of the sub-directory.
A sub-domain is a variation on your main domain. For instance, let’s say I was adding a photo gallery to my site and to do so, I could add a sub-domain of photos.matthewedgar.net. The “photos.” is the part of that domain that distinguishes the sub-domain as something separate from the main domain of matthewedgar.net.
You can think of a sub-domain as a separate website, where a sub-directory is part of the same website.
Which Method Is Best?
To start, I’ve never really found a hard and fast “best” answer. Each method has their place and purpose, but to get at which method if best for your website, I think there are three main ways of evaluating this sub-domain or sub-directory question:
The first place to start, as is often the case, is with your users (or customers or visitors). You need to ask yourself what are the user expectations of the new content you are adding to your website. Say for example that you want to add a photo gallery to your website and you are wondering if you should do that as photos.yourawesomewebsite.com (sub-domain) or as yourawesomewebsite.com/photos (sub-directory).
You want to know the extent to which the new content of your photo gallery will differ from the content currently only your existing website. Are the people who will interact with this content different – completely or partially? Would people who are interested in your current website also be interested in the content you are planning to add in your new photo gallery? Or, put another way, would people who are interested in your current website’s content be offended to see your new photo gallery content?
If the users are interconnected or are (at minimum) not put off by the mix of existing and new content, then you should probably use a sub-directory. That way your users can more easily move between your existing content and your new content you are adding. Otherwise, a sub-domain can look like a separate website, which can confuse your users or, worse, can make it look like you are hiding content from them.
As an alternative example, I created a sub-domain for SpringTrax’s support section, located at the sub-domain support.springtrax.com. I created this as a sub-domain (instead of a sub-directory at springtrax.com/support) because I knew the users of the Support content would be distinct from the people engaging with the content on the main SpringTrax website. People who want the main website are potential customers, but people who want support content are existing customers. A sub-domain let me easily create two separate sets of content for two separate sets of people.
Now that we’ve talked about user expectations, let’s also take a look at this question in terms of what will help you the most with search rankings. To be clear, the truth is that you can get pages located in a sub-directory or on a sub-domain to rank in Google (and Google says either is okay https://www.youtube.com/watch?v=_MswMYk05tk). However, there are some pretty big advantages of a sub-directory and when thinking about SEO, I tend to recommend a sub-directory.
The reason is that Google generally views sub-domains as separate websites, and each separate website has separate rankings signals (like links). For example, any ranking signals, like links, that Google associates with photos.matthewedgar.net will not do as much to help my main domain of matthewedgar.net like matthewedgar.net/photos would. That is because in Google’s eyes matthewedgar.net and photos.matthewedgar.net are two different websites (generally speaking, there are always exceptions). However, any ranking signals, like links, that Google associates with matthewedgar.net/photos (a sub-directory) could help the pages elsewhere on my website (like matthewedgar.net/blog) gain rankings.
This starts to matter especially at scale for traffic. If you created that new content as a sub-domain, you’d be starting over with essentially a new website. That can mean more work to get that new content to show up in Google. Alternatively, if your main domain is already performing quite well in search results, then your new content should more easily rank too if you create it as a sub-directory. The new content basically piggybacks on your already good content, and your website starts to look like one massively authoritative website.
The last way I evaluate this is by looking at the technical structure of your website. I tend to argue that technical limitations shouldn’t overrule what is best for your users or best for getting traffic to your website. In general, try to build a solution that works best for your users, not a solution that works best for your programmers. If that means your users do not want a sub-domain, then you should do everything you can to avoid it technically.
That is the ideal situation and that isn’t always the way the world works. In some situations sub-directories are easier to create technically and doing it another way is not a practical investment. For example, if you want to create your shopping cart on an ecommerce platform built using one technology, but then have a blog using a different/incompatible technology it is often easier to have those on sub-domains. Your shopping cart may exist at cart.yoursite.com and have your blog live at blog.yoursite.com, while the rest of your site is at www.yoursite.com. If you go this route, you will need to do the work to ensure that those sub-domains are still able to get traffic and satisfy your users.