WordPress Multisite: Subdomains or Subdirectories?
WordPress Multisite: Subdomains or Subdirectories?
When you activate Multisite on your WordPress installation, there are a number of things you need to consider and decide, such as whether you’ll let your users create their own sites, what themes and plugins you’ll make available and your registration settings.
But the one decision that’s very difficult to reverse is whether to use subdomains or subdirectories for your network. Once you’ve activated Multisite, switching between subdomains and subdirectories is time consuming and tricky – and something best avoided.
So it’s important that you get it right.
In this post, I’m going to help you with that, by explaining the difference between a subdirectory and subdomain installation. I’ll also look at some of the scenarios in which you might be activating Multisite, and identify which of subdomains and subdirectories might be better for each. I’ll also identify those scenarios where you have no choice in the matter.
So let’s start with an overview of subdomains and subdirectories.
Subdomains and Subdirectories – What’s the Difference?
Subdomains and subdirectories relate to the structure of the urls used for each of the sites in your network. They don’t actually correspond to where on your server the sites are stored, but to the way WordPress creates urls for them.
Let’s say you’ve got a network called mynetwork.com. If you set it up to run on subdomains, a site called myblog will have an address of myblog.mynetwork.com. But if you set it up to run on subdirectories, then that blog’s URL will be mynetwork.com/myblog.
A page called ‘About Me’ on your myblog site will have a URL of myblog.mynetwork.com/about-me on subdomains, while on subdirectories it will be mynetwork.com/myblog/about-me.
The same structure is used for every single site in your network – you can’t pick and mix. So once you’ve chosen, they’ll all be the same.
Which you choose will depend on a few things:
- Whether your network is on a new WordPress installation or an established one.
- Whether your network is for your personal sites or sites you will be letting other people set up or buy.
- Whether or not you’re using domain redirection.
- Your hosting – can you set up subdomains?
- Your site’s location – on a local or remote server, or in a subdirectory.
- And finally, it will depend in part on personal preference.
Let’s take a look at each of these scenarios in turn.
New vs Established WordPress Installations
If you’re activating Multisite on a new WordPress installation, then it’s up to you to decide between subdomains and subdirectories. But if your site is an established one, you’ll be forced to use subdomains. So if your site is over a month old, you’ll have no choice.
This is for the simple reason that there could be a clash between the subdirectory addresses for sites created on your new network, and content you’ve already added to the site. Imagine you’ve created a site at mygreatsite.com and added a page called “WordPress is Awesome,” with the URL mygreatsite.com/wordpress-is-awesome. You then create a Multisite network and let users set up their own sites on subdomains. Someone comes along and decides to create a site called “WordPress is Awesome,” which would have a URL of mygreatsite.com/wordpress-is-awesome (forget about any copyright issues for now). You can see how this would be a problem.
So instead, you’re forced to use subdomains, and the new site singing WordPress’s praises would be at wordpress-is-awesome.mygreatsite.com. No clash now.
Personal Networks vs Public Ones
I run three Multisite networks. Two of them are for client sites and one is for personal use. One of them runs on subdomains, which is the one that allows clients to create their own sites. Two run on subdirectories – one that uses domain redirection (more of which shortly) and the other that’s my personal site.
The reason I use subdomains for sites created by clients and subdirectories for my sites is twofold. Firstly, subdomains give a more professional feel to the service I offer my clients. Most of them use domain redirection to redirect to my IP address, but I know that if they don’t, they’ll have a domain name that starts with their brand, not mine. Secondly, subdirectories are easier to work with, so that’s what I use for my own site where it’s less of an issue.
Using subdirectories means you don’t have to worry about creating new domains or allowing wildcard domains via your hosting provider, and it just makes things simpler. For me, it also means that the sites in my personal network have urls that mirror the urls in their opposite numbers on my local copy of the network. Again, more of which later.
1.6 million WordPress Superheroes read and trust our blog. Join them and get daily posts delivered to your inbox - free!
If all the sites on your network use our invaluable Domain Mapping plugin to redirect their own unique domains to each site, then as far as your visitors are concerned, then it doesn’t matter if you use subdomains or subdirectories. This is because no-one will ever see the “real” URL for the sites in your network.
So if you’re creating a network (like one of mine) with sites that will all have domains redirected to them, then feel free to use whichever of subdomains or subdirectories you prefer – or whichever you’re forced to if that’s the case.
Personally, I use subdirectories on my network with redirected domains, for the reasons I already outlined.
Some hosting providers will make it difficult for you to work with subdomains.
They might charge you extra to set up subdomains on your account, they might not give you access to cPanel where you can set up your own subdomains, or they might not allow wildcard subdomain creation.
A wildcard subdomain is when you create a subdomain called */mynetwork.com, instead of setting up each subdomain individually. If you’re using subdomains and offering site creation to your users, then you’ll need a wildcard subdomain.
So if you want to use subdomains, then check first that your hosting provider allows it. If they don’t, you’ll either have to use subdirectories – or switch to a better hosting provider or more expensive plan.
Networks Stored in a Subdirectory
Most Multisite networks will be held in the root directory of your site. This means that if you’ve bought a hosting plan using mygreatsite.com, then that will be the url for your base site on the network.
But if for some reason you’ve installed WordPress Multisite in a subdirectory, then you won’t be allowed to use subdomains. So if you already have a single site installation at mygreatsite.com and you decide to add another WordPress installation in a subdirectory running Multisite, then its address will be mygreatsite.com/mynetwork.
If this is the case, you’ll be forced to use subdirectories, meaning that a site you create on your new network will be at mygreatsite.com/mynetwork/my-new-site. Creating a subdirectory would simply be impossible, as it would have to be at an address like mygreatsite.com/my-new-site.mynetwork. Which just doesn’t work.
Local vs Remote Networks
If you’re setting up a local Multisite network on your machine, then you’ll be forced to use subdirectories. This is because a local installation of WordPress will always be in a subdirectory itself – it will never be in the root directory of your machine.
This is one of the reasons I prefer to also use subdirectories remotely – it means that my urls are as consistent as possible between local and remote versions of my networks, making things easier if I have to migrate the database.
I’ve already stated my own personal preference, which is for subdirectories. But that’s not to say there aren’t times when I use subdomains. Networks that allow users to create their own sites will always appear more professional with a subdomain structure. After all, it’s what we use at Edublogs.
If your network doesn’t have any restrictions on it, and you’re not forced to use one or other of the two options, then you can go with your personal preference. But if you’re going to be hosting client sites on your network, it also makes sense to consider what their preferences might be, too.
Choosing Between Subdomains and Subdirectories Needn’t be Difficult
When you’re activating Multisite to create your first network and you come across the option for subdomains or subdirectories, it can feel a bit daunting. But if you follow this guide, you should be able to pick the right one for your network, both now and (importantly) in the future. There are a few criteria you’ll need to weigh up, but if you take the time to identify which option os best for your network, then it’ll save you the lengthy process of switching at a later date.