Setting Up WordPress Multisite A Comprehensive Tutorial

Last Updated on November 30, 2023 by Sunny Staff

With WordPress comes the multisite functionality with which you can run multiple WordPress websites from one single WordPress installation. A multisite simplifies the overall management of the WordPress core, users, plugins, and content when running multiple client websites, a membership site, or your own network of sites.

In this article

What is a WordPress Multisite?
Why use a WordPress Multisite?
WordPress Multisite Requirements
How to Setup WordPress Multisite Network (Step by Step)
WordPress Domain Mapping
Managing Users and Roles on a WordPress Multisite
Managing Themes and Plugins on a Multisite

What is a WordPress Multisite?

When you install WordPress on a server or your local computer, the default is to have one WordPress installation – files and database – to one website address. On the test site used for this tutorial, the files in /var/www/www.esquecreative.dev and the database serve content on https://www.esquecreative.dev.

But WordPress also has the potential to serve content on multiple addresses – from a single file and database installation. This is called a multisite installation.

Central to this is the URL structure of each of these sites served from the single WordPress installation. In other words, what does the URL of each individual site look like? Here are the various options:

Subdomain:

  • https://products.yourdomain.com
  • https://clients.yourdomain.com

With a subdomain URL structure, the name of the site is prepended to your domain name.

WordPress subdirectories:

  • https://www.yourdomain.com/members
  • https://www.yourdomain.com/magazine

With a subdirectory URL structure, the name of the site is appended to your domain name.

WordPress domains (domain mapping):

  • https://www.yourdomain.com
  • https://www.yourotherdomain.com

With domain mapping, you can run unique domains from a single WordPress installation.

During the multisite setup, you’ll have a choice between a subdomain and a subdirectory URL structure.

A note on WordPress wildcard subdomains

A wildcard subdomain refers to a DNS record where a wildcard (a placeholder) is defined instead of an actual subdomain name. It acts as an umbrella for all your dynamically created domain names.

For example, your domain may have a DNS record like this:

 

Type Hostname Value TTL (Seconds)
A *.yourdomain.com Redirects to YOUR_SERVER_IP 3600

The asterisk (*) under the hostname defines the wildcard. If you intend to use a wildcard subdomain, you’ll also have to create a corresponding hosts file capable of supporting wildcard subdomains. Here’s an example:

<VirtualHost *:80>
ServerAdmin [email protected]
ServerName example.com
ServerAlias *.example.com
DocumentRoot /var/www/html/example.com
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

Remember that mod_rewrite has to be enabled for this to work.

Where a wildcard subdomain isn’t used, you’d have to manually create a DNS record for each subdomain – not a problem for even a handful of sites, but when you’re running tens or hundreds of sites, then a wildcard subdomain is easier to manage.

A wildcard subdomain requires:

  • A wildcard subdomain DNS record (*.yourdomain.com)
  • A wildcard SSL certificate
  • A web server that supports wildcard subdomains

Why use a WordPress Multisite?

Should you really install a multisite? Or would you be better off running separate WordPress websites? Weigh the pros and cons to help you make an informed decision:

Pros of a WordPress multisite

  • Simplified management of many WordPress websites from a central location
  • Since all sites use the same WordPress installation, resource usage can be more efficient than running multiple WordPress installations
  • Plugins and themes can be installed centrally and made available to all sites – a big plus if consistent branding is a requirement
  • Centralized user management with per-site roles and privileges
  • Running a multisite can be more cost-effective when commercial themes and plugins are used (if they allow use in a multisite context)

Cons of a WordPress multisite

  • Multisites require more knowledge and skill than a single site installation to manage efficiently. Learn more about Sunny HQ’s WordPress website management.
  • User management on a multisite network can be complex, especially when assigning different roles to users across multiple sites. This can also have security implications
  • Multisites carry a higher security risk than normal WordPress installations – more sites mean more potential entry points for attackers
  • Server downtime will impact all sites in a multisite installation
  • Some plugins and themes are not multisite compatible and may not work correctly
  • Faulty plugins and themes can affect all sites
  • Migrating individual sites out of a multisite installation can be very complex
  • Not all hosts support WordPress multisite installations

If you’re prepared to take on the challenge and reward of running a WordPress multisite network, read on below to get started.

Also read: Tutorial: WordPress Website Building for Beginners

WordPress Multisite Requirements

WordPress multisites are a little different than standard WordPress sites, not only in terms of operation but also with hosting and domain requirements.

Multisite hosting requirements

Shared hosting is arguably the cheapest form of hosting, especially for single WordPress sites that do not require much in terms of resources. Although you could run a WordPress multisite on shared hosting, a cloud server with dedicated resources is often recommended because of the default amount of resources and scalability (read: future-proof resource availability).

Other multisite hosting-related requirements:

PHP version: The current minimum version of PHP required to run WordPress is 7.4. Plugins and themes may require a newer PHP version.

MySQL version: The current minimum version of MySQL required to run WordPress is 5.6+.

Server memory: Although a WordPress website can run on as little as 64MB RAM. For multisites, the recommended minimum is 512MB – 1GB RAM.

Disk space: Providing a minimum amount of disk space can be tricky since websites have different requirements depending on how they’ll be used. But given that storage space is generally affordable and, accounting for the growth of your WordPress multisite, starting out with 5GB – 10GB should be sufficient.

Bandwidth: Depending on the intended purpose of your multisite (e.g. a membership site where every user gets a subdomain or directory), you may require more bandwidth than the average single WordPress website.

SSL certificates: For subdirectory URL structures you’ll need an SSL certificate for your domain.

If you’re staying with the default subdomain directory structure (see above), you’ll need an SSL certificate for each subdomain. Where you anticipate a large number of subdomain sites, a wildcard SSL certificate is recommended.

If you’re set on using domain mapping to host true domains on your WordPress multisite, you’ll need an SSL certificate for each of the true domains you plan to use.

mod_rewrite: This is an Apache module needed to rewrite URLs. mod_rewrite must be enabled, especially if you intend to use a subdirectory URL structure.

Options FollowSymLinks: This is an Apache directive, often needed for security and URL rewriting. If you intend to set up your multisite on shared hosting, it’s best to first check with your host whether this directive is enabled.

AllowOverride All: This Apache directive allows .htaccess files to override the server’s main configuration settings – often necessary to ensure proper functioning of permalinks and other rewrite rules.

 

Also read: WordPress CDN: Choosing the Best Solution for Your Website

How to Setup WordPress Multisite Network (Step by Step)

Setting up a WordPress multisite requires only a few configuration changes, making it pretty straightforward.

Important: Create a backup of your site files and database if you intend to use an existing website for your WordPress multisite. It’s also recommended to ensure that WordPress is updated to the latest version and that all plugins are deactivated.

Step 1: Edit wp-config.php

Locate your wp-config.php in your site’s root directory. Add the following line to wp-config.php just above  /* That's all, stop editing! Happy publishing. */:

/* Multisite */

define( 'WP_ALLOW_MULTISITE', true );

Save and close the file.

Next, open the WordPress dashboard in your browser and go to Tools > Network Setup. Here you need to choose the URL structure of the sites in your network – ‘Sub-domains’ or ‘Sub-directories’. I’ll leave it on the default, ‘Sub-domains’.

Click on Install.

WordPress Multisite Install

For the purpose of this tutorial, we’ll be using manually created subdomains (as opposed to wildcard subdomains) as an example, and also explore domain mapping. As such you’ll see the warning received during the multisite installation in the screenshot below that can be safely ignored if you’re following the same route. If you have your wildcard DNS and virtual hosts set up, you shouldn’t receive a warning.

Also read: How To Fix the WordPress White Screen of Death Like a Pro

WP Multisite Post Install

Copy and paste the provided code into your wp-config.php and .htaccess files respectively.

For wp-config.php:


define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', true );
define( 'DOMAIN_CURRENT_SITE', 'www.esquecreative.dev' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

If you’re using the code above, remember to replace the domain with your domain name.

For .htaccess:

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule . index.php [L]

How to Add New Site to WordPress Multisite

You’ve now successfully enabled multisite functionality for your WordPress website. The next step is to start adding sites.

Go to your WordPress dashboard. Hover your mouse over My Sites > Network Admin and click on Sites.

WP Multisite Mysites

Click Add New at the top of the Sites page.

Add New Site

Here you need to provide the details of the subsite you want to install. I’ll create a site called ‘demo’ which will be accessible at https://demo.esquecreative.dev.

(Since I haven’t created a wildcard DNS record, I’ll also need to create a DNS record for demo.esquecreative.dev, a virtual host for ‘demo’, and add an SSL certificate. If you’re following the same route, remember that the document root and Directory directive will have to point to the main site’s directory. These steps won’t be documented here, but this is just to elaborate on the process you’ll need to follow for each site you wish to add.)

  1. Enter the subdomain name of your new site, e.g. demo
  2. Give your new site a title
  3. If necessary, select a different site language
  4. Lastly, specify an admin email

Click on Add Site.

Create New Site

Now when you hover your mouse over My Sites > Network Admin and click on Sites, you’ll see your new site listed.

My Sites List

WordPress Domain Mapping

But what if you wanted to run two or more true domains from a single WordPress site, for example, yourdomain.com and yourotherdomain.net?

With domain mapping, you change a subdomain site into a true domain site. Here’s how:

Navigate to My Sites > Network Admin and click on Sites. Add a subdomain site as explained previously. Since we’ll be changing the subdomain, there’s no need to add a virtual hosts entry or create a DNS record for your subdomain site. It will, however, be necessary for the true domain.

Temporary Subdomain Site

Go back to My Sites > Network Admin and click on Sites. Locate the subdomain you just added and click on Edit. Enter your true domain URL in the Site Address (URL) field, followed by a forward slash, e.g. www.yourotherdomain.com/.

Domain Mapping

Remember that you’ll need a virtual hosts entry for your true domain as well as DNS records and an SSL certificate.

Managing Users and Roles on a WordPress Multisite

The usual WordPress roles – administrator, editor, author, contributor, and subscriber – still apply in a multisite setup and are assigned on a per-site basis. One of the most notable differences is the addition of the Super Admin role.

The WordPress Super Admin role

Just like the Administrator has global privileges on a normal WordPress installation, so does the Super Admin enjoy global privileges across all sites of your multisite installation. The Super Admin:

  • Can access the Network Admin dashboard
  • Can add and delete sites
  • Can manage network-wide plugins and themes
  • Can create and manage users across the entire network
  • Can modify network settings

Given the reach of Super Admin privileges, discretion is strongly recommended when assigning this role.

Managing WordPress users on a multisite

Users can be added by the Super Admin in the Network Admin Dashboard > Users. They can then be added to individual sites from the site’s Dashboard > Users page by the Super Admin or the site administrator.

The Super Admin can also manage per-site users from the Network Admin Dashboard > Sites > All Sites. Select a site to edit and click on the Users tab.

Alternatively, users can also be added by a site administrator from the site’s Dashboard > Users page.

Managing Themes and Plugins on a Multisite

Themes and plugins can also be managed centrally, or on a per-site basis by the Super Admin.

Themes

  • Themes can be enabled network-wide for all sites by the Super Admin from the My Sites > Network Admin > Themes. It’s up to the individual site administrators to choose and activate a theme.
  • Themes can be enabled for selected sites from My Sites > Network Admin > Sites. Click Edit on the site in question, and then click on the Themes tab.
  • Theme options can be adjusted by administrators of individual sites without affecting other sites on the network using the same theme
  • When a theme is updated by a Super Admin, it is updated across all sites using that theme.

Plugins

  • The Super Admin can network-activate plugins, which will make those plugins available to all sites. Some plugins allow settings to be configured on a network-wide and/or per-site basis.
  • The Super Admin can allow administrators of individual sites to activate and deactivate plugins by enabling ‘Plugin Management’ for those sites.

The central management of themes and plugins lends itself to improved security since all themes and plugins can be updated quickly and efficiently.

Also read: Essential WordPress Security Tips Every Site Owner Should Know

What to do next

Setting up and managing a WordPress multisite requires technical expertise. Even when you have that technical know-how, it can still eat away at your time. Wouldn’t you rather spend all those hours making your WordPress multisite grow? Sign up with Sunny HQ and we’ll not only help you set up your multisite to work the way your business does, but we’ll also keep it safe and well-managed.