How to setup WordPress Multisite

1
WordPress MultiSites
WordPress MultiSites

After setting up WordPress on your Local Machine, it’s time to move to multi-sites WordPress features. The cool thing about multisite is that it allows you to share a common set of themes, plugins, and authors among several different blogs or sites.

Having Multisite setup on a local machine provides a great way to test themes and plugins in a Multisite environment, but also makes it a quick and easy to have multiple sites running at once.

We hope you have read our previous article on “A full Tutorial on Installation of WordPress on XAMPP“.

Before starting the how to setup WordPress Multisite Tutorial, we’d like to note you the benefits of WordPress Multisite.

The Benefits of WordPress Multisite

Enabling multisite on WordPress you’ll be able to take advantage of many benefits. WordPress multisite allows you to:

  • Share one custom theme among all of your multisite blogs. We made slight adjustments to each of them using child themes.
  • Share one set of authors. There is only one username/password combination for each user, plus one profile to manage.
  • Distribute plugins across all blogs, rather than managing them individually for each install. This goes for WordPress updates as well.
  • Simplify the blogging process. By logging into one blog, we have access to each of them.

Setting up Multisite WordPress on Local Server

Open your wp-config.php file and add/edit the following lines to activate Multisite’s installation mode:

Activate Multisite installation mode.
Activate Multisite installation mode.

 

Open XAMPP and ensure your Apache and MySQL servers are running.

Login to your localhost site in your browser and under “Tools” you will now have a new option, “Network Setup.”
Network setup

Enabling Multisite will add a new “Network Setup” sub-menu item to WordPress.
Enabling Multisite will add a new “Network Setup” sub-menu item to WordPress.

Enter a name for your network and your email address, then click “Install.”

WordPress will prompt you to edit your wp-config.php and .htaccess files.

Following the onscreen instructions, open wp-config.php and add the following lines underneath your previous edit:

Edit your wp-config file to get Multisite up and running.
Edit your wp-config file to get Multisite up and running.

 

Next, open .htaccess. If you can’t find it, make sure hidden files are displaying on your computer.

Your .htaccess file should look like this:

Edit .htaccess
Edit .htaccess

Edit your .htaccess file to complete your Multisite installation.

Multisite should now be enabled and working on your WordPress site!

Multisite network
Multisite network

Your Multisite network should now be up and running!

Setting up your sub-domains or sub-directories for Live MultiSites

1. Now go to Tools > Network Setup and choose whether you want to use sub-domains or sub-directories

  • Choose wisely as you can’t change this later
  • Contact your host first if you want to use sub-domains to ask if they are able to set up Wildcard DNS records for your site as not all hosting companies support this option

a. Sub- domains

If you want to use sub-domains you will need to contact your host and ask them to set up Wildcard DNS records for your site e.g. log into your support area of pSek and ask them to set up Wildcard DNS records for your site.

  • Sub-domains have site URLs like site1.domain.tld and site2.domain.tld
  • Not all companies allow you to use sub-domains and you need to check with your hosting company before choosing this option.

b. Sub-directories

This is the easier option because you don’t need to get your hosting company to set up Wildcard DNS records for your site.

  • Sub-directories have site URLs like domain.tld/site1 and domain.tld/site2

2. Once you have chosen between sub-domains or sub-directories and double-checked all details are correct then click Install.

  • Your Apache mod_rewrite should have already been enabled by your hosting provider so this is something that you generally don’t need to worry about or deal with.
    Create a Network of WordPress Sites
    Create a Network of WordPress Sites

3. Once you’ve clicked Install you should see a page titled Enabling the Network with further instructions for creating your network.

Enabling Multisite Network
Enabling Multisite Network

 

4. Before you commence the next step create a backup of your wp-config.php and .htaccess file by downloading them onto your hard drive.

Add the extra lines your WordPress installation generates into your wp-config.php

1. Add the supplied code for your wp-config.php file from the ‘Enabling the Network’ page above the line reading /* That’s all, stop editing! Happy blogging. */: and remove the earlier added define(`WP_ALLOW_MULTISITE`, true); line. As of WordPress 3.8, the code you should be copying looks like this:

define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'wpsingle.net');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

2. Save your new wp-config.php file and reupload it to the root of your website.

Add the generated mod_rewrite rules to your .htaccess file, replacing other WordPress rules.

1. Add the supplied rules for your .htaccess file from the ‘Enabling the Network’ page to replace all other WordPress rules in the .htaccess file with the supplied code. As of WordPress 3.8, the code you should be copying looks like this:

RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [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).*) $2 [L] RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L] RewriteRule . index.php [L]

2. Save your new .htaccess file and reupload it to the root of your website.

The examples above are for subdirectories. Subdomains will be a bit different, but either way you should always copy exactly what WordPress gives you on that screen.

Video Tutorial on WordPress MultiSite Setup

Here’s a video tutorial from WPMU DEV channel on Youtube showing how setup WordPress MultiSite.

[box title=”More on WordPress” box_color=”#0b41d5″ radius=”5″] [/box]

Ref: WPMU DEV

You might also like
1 Comment
  1. Hari Prasad Chaudhary says

    Wow! very informative and meaningful article. Just know the new functionality of WordPress, thanks.

Leave A Reply

Your email address will not be published.

5 × two =

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More