How to SetUp Multiple WordPress Sites Using Multisite

With WordPress 3.0, a major shift was introduced where WordPress MU was merged with the main WordPress configuration, called ‘WordPress Multisite’. Since then, it’s easy to create and manage multiple WordPress sites on one server from a single wordpress installation.

This will help  to set up multiple wordpress sites using multisite feature.

System Requirements

  • The user should have root privileges
  • LAMP stack should be installed on your vps
  • WordPress should be installed

 SetUp the WordPress Installation

A couple of changes have to be made in the configuration files after wordpress is installed. Multisite network feature will be built-in with wordpress install. All you need to do is activating the multisite networking. Open the wp-config.php file for editing.

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

You need to add this line before ‘/* That’s all, stop editing! Happy blogging. */’

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

Save the config file.

Now, activate the mod-rewrite module for apache.

sudo a2enmod rewrite

Open up the virtual host file for making changes. Here, in this tutorial I have made the changes to the default apache file.

sudo nano /etc/apache2/sites-enabled/000-default

Update AllowOverride to All:

<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

Now, restart apache to bring in all the changes.

sudo service apache2 restart

Now the wordpress online installation page will be up and running. Navigate to the page by adding wp-admin/install.php to your IP or domain (yoursite.com/wp-admin/install.php). Just follow the instructions and fill out the online form.

Setting Up Multiple WordPress Sites

 

Navigate to your wordpress dashboard and select ‘Tools’ section as shown:

multiple wp sites-dashboard

 

Fill out all the required fields and go through the directions.

multiple wp sites-dashboard 2

 

Now, you need to create a directory for your new sites. Run the command to make a directory.

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

Open up the wp-config.php file for editing and paste the following above ‘/* 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 the wordpress rewite rules into the .htaccess file at /var/www.

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]

Once these steps are followed, log into your WordPress again.

Setting Up Your New WordPress Site

 

After logging in to your wordpress, you will be able to see one ‘My Sites’ section on the header bar. You can start creating your new sites by navigating to My Sites -> Network Admin -> Sites.

new wp site

 

new wp site 2

Similarly, you can add more sites.

KB Admin has written 46 articles