Setting Up Multiple WordPress Sites Using Multisite

Introduction

WordPress is the most popular CMS (content management system) on the internet. It allows you to easily set up flexible blogs and websites on top of a MySQL backend with PHP processing. WordPress has seen incredible adoption and is a great choice for getting a website up and running quickly.

If you plan to have more than one WordPress website or blog, there are different ways to accomplish this.

  • First option is to install multiple independent WordPress instances on the same server. With this option each website needed to have its own installation and configuation so you need more time to do the installation for each website.
  • Second option is to install WordPress Multisite, which lets you create and manage multiple WordPress blogs/websites from a single WordPress instance. This option might be a good option . It easier to create multiple WordPress sites on one server and lets you manage multiple websites from a common dashboard, and you have the added advantage of being able to share themes and plugins between your WordPress Multisite sites.

If you haven’t installed Wordpress yet, check the following article.

On Debian based systems:

On RPM based systems:

Following on from my previous article How To Secure WordPress Website  show you checklist allows you to secure and test your WordPress site with as little effort as possible.

What is WordPress Multisite?

A WordPress multisite network allows you to run and manage multiple WordPress sites from a single WordPress installation. You can create new sites instantly and manage from a single dashboard. You can install plugins and themes on multiple sites in one time. Multisite network also makes it easier for you to manage updates. You only need to update your WordPress, plugins, or themes on one install.

Install WordPress Multisite

To begin with, modify the WordPress configuration, activating the multisite networking:

sudo nano /var/www/wp-config.php

You need to add this line to your

wp-config.php

file just before the /* That’s all, stop editing! Happy blogging. */ line.

/* Multisite */
define('WP_ALLOW_MULTISITE', true);

You will see this error message if you don’t enable multisite in your wp-config.php file.

wp

Once you have enabled multisite through wp-config.php and saved the file, you will see a new option in your tools menu entitled “Network Setup” (located at www.yourdomain.com/wp-admin/network.php).

wpYou need to make sure that the mode rewrite is enabled. You can activate the apache mod_Rewrite module by typing this command:

sudo a2enmod rewrite

Now that you have successfully enabled the Multisite Network feature on your WordPress site, it is time to set up your network.

Before you proceed with the installation you need to deactivate all of your WordPress plugins. This is a precautionary measure that avoids any conflictions occurring.

wp

At this stage , go into your WordPress dashboard and select Tools => Network Setup.

wp

You can add an admin email address other than the one you are currently using to manage your multisite.

Once you are done, click on the button Install.

wp

Create a directory for your new sites:

sudo mkdir /var/www/wp-content/blogs.dir

Alter your WordPress configuration. Make sure to paste this above the line /* That’s all, stop editing! Happy blogging. */:

sudo nano /var/www/wp-config.php
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
$base = '/';
define('DOMAIN_CURRENT_SITE', 'YOUR IP ADDRESS HERE');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

Now, add WordPress’s rewrite rules to /var/www htaccess file:

sudo nano /var/www/.htaccess
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

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

After successfully setting up the Multisite Network, log into WordPress Dashboard once more  you will notice that the header bar now has a section called, “My Sites” instead of simply displaying your blog’s name.

wp

To add a new site to your WordPress multisite, simply click on Sites under My Sites.

wp

 

That’s all.

We hope this article helped you install and setup WordPress multisite network.

Following on from my previous article How To Secure WordPress Website  show you checklist allows you to secure your WordPress site with as little effort as possible.

If you have any feedback or comments, feel free to post them in the comment section below.