WordPress Multisite: Subdomains or Subdirectories?

When you activate Multisite on your WordPress installation, there are many things you need to consider, such as whether you’ll let your users create their own sites, what themes and plugins you’ll make available on the network, and your registration settings.

But the one decision that’s challenging to reverse is whether to use subdomains or subdirectories for your network.  Switching between subdomains and subdirectories is time consuming and tricky – and something best avoided.

It’s important that you get it right the first time.

In this post, I’ll help you with that, by explaining the differences between WordPress Multisite subdomain and subdirectory installation. I’ll also look at some scenarios in which you might need Multisite, and identify which of subdomains and subdirectories might be better for each. I’ll also identify those scenarios where you have no choice.

So let’s start!

Subdomain vs. Subdirectory – What’s the Difference?
New vs. Established WordPress Installations
Personal Networks vs. Public Ones
Domain Redirection
Hosting Challenges with WordPress Multisite Subdomain
Networks Stored in a Subdirectory
Local vs. Remote Networks
Your Site, Your Choice
Choosing Between Subdomains and Subdirectories Needn’t Be Difficult

Subdomain vs. Subdirectory – What’s the Difference?

WordPress Subdomains and Subdirectories relate to the structure of the URLs used for each of the sites in your Multisite network. They don’t correspond to where your server stores the sites, but to the way WordPress creates URLs for them.

This demo site on my personal network uses a subdirectory structure.

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.

It uses the same structure 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 let other people set up or buy.
Whether 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 your preference.

Let’s look at each of these scenarios.

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 you have an established site, you must force the use subdomains. So, if your site is over a month old, you’ll have no choice.

This is because 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 subdirectories. Someone comes along and creates 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.

Once you’ve finished activating Multisite though, you can switch between subdomain and subdirectory installations.

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. First, 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. Second, subdirectories are easier to work with, so that’s what I use for my site where it’s less of an issue.

Edublogs makes it possible for users to create their own sites, so it uses subdomains

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 URL in their opposite numbers on my local copy of the network. Again, more on that later.

Domain Redirection

If all the sites on your network use our invaluable Domain Mapping guide to redirect their own unique domains to each site, then as far as your visitors go, 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 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, I already outlined.

Hosting Challenges with WordPress Multisite Subdomain

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.

If you want to use subdomains, you must be able to edit them in cPanel or a similar system.

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 (hint: WPMU DEV Hosting supports wildcard subdomains and all of our premium plugins are Multisite compatible too).

Networks Stored in a Subdirectory

Most Multisite networks are installed 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 you’ve installed WordPress Multisite in a subdirectory, then you can’t use subdomains. So, if you already have a single site installation at mygreatsite.com, and you add another WordPress installation in a subdirectory running Multisite, then its address will be mygreatsite.com/mynetwork.

If this is the case, you MUST 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 be impossible here, 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, as in the above example, you MUST 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 reason I prefer to 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.

Your Site, Your Choice

I’ve already stated my 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. It’s what we use at Edublogs.

At Edublogs we use subdomains as it’s better for users

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 preference. But if you will host client sites on your network, it also makes sense to consider what their preferences might be, too.

You may also want to check out Why Subdomains For Multisite Is A Very Bad Idea before making a decision.

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 daunting. But if you follow this guide, you should be able to pick the right one for your network, both now and (importantly). There are a few criteria you must weigh up, but if you take the time to identify which option is best for your network, then it’ll save you the lengthy process of switching at a later date.

Щелкните ниже, чтобы поставить оценку!
Всего: 0 В среднем: 0

Написать комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *