WordPress has an advanced mode that lets you run several sites at once on the same install: WordPress MU for Multisite. But this feature is hidden, and enabling it requires a bit of documentation.

Prerequisites

In this article we'll need an existing WordPress install in order to add the features specific to multisite.

This procedure will somewhat transform your install by adding, among other things, many tables to your database. It's not necessarily easy to undo this operation cleanly, unlike simply deactivating a plugin.

So, if you just want to test this option, I recommend first running the procedure on a test site rather than directly on your production site.

Turning an existing WordPress install into a multisite

To start, let's add this code to the wp-config.php file located at the root of our project:

Adding this constant won't create the site network, it will only add a new section to the WordPress admin panel.

Starting the site network creation

Careful, it's subtle: in the Settings tab, you now have a new section, "Network Setup".

A new section has appeared under Tools > Network Setup

First, we're going to need to deactivate all our plugins. This is a prerequisite for the tool to work.

That's it, the site network is created.

Choosing the URL format

You'll then need to choose which option we prefer for the URLs of our different sites:

  • Use subdomains (site1.site.com, site2.site.com...)
  • Use subfolders (site.com/site1, site.com/site2)

These different use cases can be useful in different contexts. For the rest of our example, we're going to go with the first option and use subdomains.

Configuring the .htaccess file

Once our choice is confirmed, WordPress asks us to make a few adjustments to the WordPress configuration.

In the .htaccess file, we're going to replace everything between the <if mod.c> ... </> tags:

Configuring the wp-config.php file

We're also going to go back into the wp-config.php file we already edited earlier and add the following lines:

Make sure to keep the WP_ALLOW_MULTISITE constant we created earlier, otherwise we won't be able to see the site-network-specific options in the Dashboard.

We can now create our different sites