How to Setup WordPress Multisite Network?

Blog No Comments

Back in 2010, WordPress released version 3.0 of its popular content management platform. In this version, the WordPress community merged WordPress Multisite into the main WordPress Configuration. This change revolutionizes the creation of multiple WordPress sites on one server by making it an easy task for the user. In early days, each WordPress blog on server needed to have its own installation, now a new WordPress site can be installed once, & other blogs can be setup from within the WordPress dashboard.

 

What is a WordPress Multisite?

A WordPress Multisite is a type of network which enables you to run and manage multiple WordPress sites from a single WordPress Installation. This feature enables you to create new sites straightaway and managing them as easy as logging in your username and password. It also enables you to allow other users to sign up and create their blogs in your domain.

 

Pros of a Multisite Network

  • You can easily manage multiple sites with one Dashboard as a network administrator.
  • Each of those sites will have their own admins with competencies to manage their own site.
  • You can install plugin and themes with just one download.
  • This also makes easy for you to manage updates as you only need to update your plugins and themes just once.

Read out some more benefits of using Multisite Network.

 

Cons of a Multisite Network

  • Every site in your network shares the same resources so, when the site is down then all the sites in your network will be down.
  • In the case of unexpectedly high traffic, it is quite a herculean task to manage server resources for a beginner level user.
  • Some of the plugins of WordPress might not work properly on a multisite network.
  • If someone hacks your site, then all the other sites on your network will be hacked.

 

Who exactly needs a WordPress Multisite Network?

Do not mislead yourself with this thought that since you have multiple WordPress sites so you need WordPress multisite. There is software like ManageWP & InfiniteWP to manage multiple sites.

Although, it makes sense to create a Multisite network for:

  • A business site with different subsites for different location and branches.
  • Your own network of blogs running on different domains.
  • Schools and colleges allowing students to create their own blogs on the school server.
  • A magazine site with different sections managed by different teams.
  • Government organizations & NGOs can use multisite for different departments, locations, and regions.

 

First, let me be very clear on this for this tutorial, you must have root privileges. If not then please can go through this link to set that up. Initial Server Setup

Also, LAMP is a must, you cannot skip it. So, you must have LAMP installed on your virtual private server. And if you don’t have Linux, Apache, MySQL, PHP stack on your VPS, you might want to go through this tutorial. Ubuntu LAMP tutorial.

Now, let’s install the WordPress. But make sure to stop at step 4 (We have to add one more thing to the WordPress config file).

 

Step one: Setup your WordPress installation

With WordPress installed, we need to take a series of steps in a variety of configuration files. Modify the WordPress configuration, activating the multisite networking:

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

Add the following line above “/*That’s all, stop editing! Happy blogging.*/”

/*Multisite*/

define (‘WP_ALLOW_MULTISITE’,true);

Activate the apache Mod_Rewrite module:

sudo a2enmod rewrite

Now, follow-up by permitting .htaccess changes in the virtual file. After this, open your virtual host file (Here, we are making these changes in the default Apache one).

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

In the following section, we will change AllowOverride to All:

</Directory /var/www/>

Options Indexes FollowSymLinks

Multiviews

AllowOverride A//

Order allow, deny

allow from all

</Directory>

Now, restart apache:

sudo service apache2 restart

Once you did this all, the WordPress online installation page is up & waiting. Just Access the page by adding /wp-admin/install.php to your site’s domain and fill out the online short form.

Let’s move to the second step.

Step 2: Setup Multiple WordPress Sites

Now, go to your WordPress Dashboard and select the section called tools -> Network Setup. Once you filled out the required fields, go through the directions on the next page.

 

Create a directory for your new site:

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

Now Alter your WP 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 as a final step, 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]

Step 3: Setup your new WordPress site

After you log into your site once again, you will notice that the header bar now has a section called, “My Sites” instead of simply displaying your blogs’ name.

You can create new sites, simply click My Sites and then select Network Admin and then click on Sites.

 

Configuring WordPress Network Subdomains

In the installation guide above, the process of setting up a multisite network that uses subdomains is exactly the same as setting up multisite WordPress Network using directories.

But, subdomains require a little more configuration after you have followed the above steps.

First thing is to check with your hosting company to verify that your account support subdomain. Also, make sure that the WordPress is installed in the root of your domain. The next thing to do is to map each subdomain to your WordPress installation i.e. the same directory as your website’s wp-config.php file.

I recommend creating a wildcard subdomain through your hosting control panel because; it is easier to handle this issue. Every hosting control panel has a dedicated page that allows you to create & manage subdomains.

To create a wildcard, all you need to do is add an asterisk (*) as the subdomain. You also need to specify the document root i.e. the location of your WordPress installation.

Now, what if you are already using subdomains? Then I would say don’t use a wildcard. For this case, you need to create a subdomain manually for each website you add to your network. It is a minor inconvenience but trust me you don’t want the consequences. Check this image out it’s quite easy to manually create the subdomain.

Remember, as long as you plug your subdomains to the WordPress installation, WordPress will certify that everything works properly.

 

Setting up The Network

It is time to set up your network. But before that, the first thing you need to do is deactivate all plugins on your site. After that, you need to go to Tools » Network Setup to configure your multisite network.

On the network setup screen, you will see a notice that you need Apache’s mod_rewrite module installed on your server to setup multisite network. This module is installed and enabled on most reputable WordPress hosting providers.

The next thing you need to do is to tell WordPress what kind of domain structure you will be using for sites in your network, e.g. Subdomains or Subdirectories. After that, you would need to provide a title for your Network and make sure that the email address in the Network Admin Email is correct. Lastly, click on the install button to continue.

On the next screen, WordPress will show you some rules that you need to add to your wp-config.php and .htaccess file. Use an FTP client to edit those two files and copy paste the code.

 

Configuring Network Settings

After successfully setting up the Multisite Network, you need to switch to the Network Dashboard to configure network settings, add new sites, and do lots of other things. Take your mouse over to My Sites menu in the admin toolbar, a fly down popup will appear. Click on Network Admin » Dashboard.

Here, you will see there are new menu items to manage your network. To configure the network, you need to select the Setting link in the admin sidebar.

On the Network Setting screen, you will see Your Site Title and admin email address. Fill these out as you did earlier in the network setting.

 

Configuring Multisite Network for Registration

The Registration Setting is the most important setting in setting up your network setup. There you will see that user registration and site registration are disabled, don’t worry it is by default setting. You can choose to open your site for user registration or allow the users to create new sites or both.

So, check the box, whichever option suits the nature of your site.

Limited Email Registration options will countenance you to limit site or user registration to the email address from specific domains, then you can add those domains here. This is, for the most part, useful if you only want to allow people from your own organization to register and create users or sites. Similarly, you can also ban certain domains from registration.

 

New Site Setting

The New Site Setting on the network setting enables you to manage default options for the new sites on your multisite network. If you want, you can even modify the contents and welcome emails.

 

Troubleshooting WordPress Multisite Issues

Most common issues occur due to incorrect configuration of Wildcard Subdomains. Make sure that your web host supports wildcard subdomains.

Another common issue is that when using WordPress Multisite with sub-directories, some users are unable to login to the admin area of their sites after they add the required code in wp-config.php file. To fix this, try replacing

define(‘SUBDOMAIN_INSTALL’, false);

line in wp-config.php file with

define(‘SUBDOMAIN_INSTALL’, ‘false’);.

I hope that this tutorial helps you in every sort. Please post a comment if face any issue. I would love to rectify the issue if any.

 

Author Bio:

Sarah Clarke is working as a professionally qualified WordPress developer at WordSuccor Ltd., a renowned firm providing wordpress multisite development services at very reasonable cost with a global reach. She loves to share her thoughts on WordPress and always looking for learning something new about it. You can follow her company on various social media sites such as Google+, Facebook, and Twitter.

We really appreciate you for visiting PremiumCoding and reading this article! Now you might also want to check out our Themes here.