How do you run a wordpress multisite locally?

Solution:1

A easy workaround is creating entries in your hosts file (for windows: %SystemRoot%\System32\drivers\etc\hosts, for linux: /etc/hosts). For that, you choose a domain name which is not using a real top level domain, e.g. wordpress.local and add a list of multisite examples in your hosts file:

127.0.0.1  wordpress.local
127.0.0.1  www.wordpress.local
127.0.0.1  test.wordpress.local
127.0.0.1  example.wordpress.local
127.0.0.1  more.wordpress.local

Now you can use wordpress.local for your multisite domain. Of course you need to configure your apache to handle these hosts.

Solution:2

To begin with, make certain that you have administrator rights to access your computer’s file system. This is because you’ll need privileges to create directories and edit files.

We’ll presume that you’ve installed WordPress on your computer already. But just in case you need help with this, you can always look into our earlier guide.

Note. This is a required step. In order to follow through and install WordPress multisite on your local computer, you first need to have a standard WordPress installation running. Again, please check out our other guide – it’s a step-by-step tutorial, quite easy to follow.

To install WordPress multisite locally and create a network of any number of sites on your own computer, follow these steps:

Before you start:

Choice of URL: Now’s the time to decide whether to install additional sites in a sub-directory or under a sub-domain. It’s important to realize that you cannot change this later.

  • sub-domain URL for the individual sites will read: site1.YOURSITE.comsite2.YOURSITE.com
  • A sub-directory URL for the individual sites will read: YOURSITE.com/site1YOURSITE.com/site2

On a live server, you can install both under a sub-domain or a sub-directory. Installing a sub-domain on a local host is a little more technical. It involves configuring the XAMPP application to create a sub-domain and then registering it in the operating system software files. In this post, we’ll deal with only a sub-directory installation on the local server.

Enabling the Multisite Feature

1. Adding the multisite feature:

Firstly, open your wp-config.php file and find the line, ‘/* That’s all, stop editing! Happy blogging. */‘ towards the end. Just above this phrase, add this piece of code:

define('WP_ALLOW_MULTISITE', true);

Then save and close the file.

2. Setting up your network:

At this point, you should see a new item in your WordPress dashboard. Specifically, go to Tools > Network Setup. Once there, choose either sub-domains or sub directories.

If you’re going with a sub-domain network on a live server, you’ll need to obtain something called a wild card DNS from your hosting service provider. Since, we’re only doing a sub-directory install on a local server, you do not need any permissions. Fill in the details and then click on install.

 

A few lines of code will be generated, and you need to add them in your wp-config.php file and in your .htaccess file.

 

After inserting the code, save the files. With this, WordPress Multisite is now successfully installed.

To access your Network Admin Dashboard, you’ll have to login afresh.

3. Adding sites to your network:

At this point, you can start creating sites and adding them to your network by clicking through My Sites > Network Admin > Sites > Add New:

Fill in the details for the individual sites, such as Address, Title and email. Then Click Add Site.

In the same manner, you can add as many sites as you want. You’ll see all the sites in your Network under All Sites.

4. Add themes and plugins:

With multisite in place, a Network Admin can install themes and plugins on multisite. These themes and plugins can be activated across the entire network, or selectively on a per-site basis.