Tutorial

How To Set Up Multiple WordPress Sites Using Multisite

Updated on March 14, 2021
How To Set Up Multiple WordPress Sites Using Multisite

About Multiple WordPress Installs

In 2010, WordPress released version 3.0 of it popular content management platform. Among the many improvements included in the release, the WordPress community combined WordPress MU into the main WordPress configuration. Since the change, WordPress has made it easier to create multiple WordPress sites on one server. Whereas earlier, each WordPress blog on a server needed to have its own installation, now a new WordPress site can be installed once, and other blogs can be set up from within the WordPress dashboard.

Setup

The steps in this tutorial require the user to have root privileges. You can see how to set that up in the Initial Server Setup

Before working with WordPress, you need to have LAMP installed on your virtual private server. If you don't have the Linux, Apache, MySQL, PHP stack on your VPS, you can find the tutorial for setting it up in the Ubuntu LAMP tutorial.

Once you have the user and required software, go ahead and Install WordPress. However—make sure you stop at the end of step 4 (We will add one more thing to the Wordpress config file in the next step)

Step One—Setup Your WordPress Installation


With WordPress installed, we need to take a series of steps in a variety of configuration files.

To begin with, 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);

After that save the file and exit. You can do so by pressing CTRL+O to save and then followed by CTRL+X to exit.

Activate the apache Mod_Rewrite module:

sudo a2enmod rewrite

Follow up by permitting .htaccess changes in the virtual file. Open up your virtual host file (I am simply going to make these changes in the default Apache one).

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

In the following section, change AllowOverride to All:

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

Restart apache:

sudo service apache2 restart

Once that is all done, the WordPress online installation page is up and waiting for you:

Access the page by adding /wp-admin/install.php to your site's domain or IP address (eg. example.com/wp-admin/install.php) and fill out the short online form.

Step Two—Setup Multiple WordPress Sites

Go into your WordPress dashboard and select the section called tools:

networking setup

Once you have filled out the required fields, go through the directions on the next page (I have elaborated on them further under the image):

next page
  1. Create a directory for your new sites:
    sudo mkdir /var/www/wp-content/blogs.dir

  2. 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);
  3. Finally, 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 making all of the necessary changes, log into WordPress once more.

Step Three—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 blog’s name:

header

You can create new sites by going to My Sites at the top, clicking on Network Admin, and clicking on Sites:

create a new site
By Etel Sverdlov

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the author(s)

Etel Sverdlov
Etel Sverdlov
See author profile
Category:
Tutorial

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
10 Comments
Leave a comment...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

How to set up WordPress Multisite for nginx ? Any tutorials ? Im newbie.

@ozan

I came across this article. I’ve not tried the tutorial, but I look forward to another Digital Ocean tutorial on this topic.

http://wpmu.org/wordpress-multisite-wordpress-nginx/

alexdo
Site Moderator
Site Moderator badge
March 27, 2024

Thanks for sharing this article here in the community. We’re working on a lot new tutorial, so keep checking the community for new releases!

Regards

Excellent tutorial too btw, worked great on Ubuntu 12.10 x64 Server.

alexdo
Site Moderator
Site Moderator badge
March 27, 2024

The tutorial was updated several times, since then. It should be fully working on Ubuntu 20.04 as well.

As of 6/24/13 the images in the post do not show the Subdomain option of multisite. If you use the subdomain option it does change the rest of the instructions slightly since you don’t need to create a blogs.dir folder.

I just learned that the change I referred to previously in regard to blogs.dir is due to a change in how Wordpress handles multisite uploaded_file_path after version WP 3.5.

http://codex.wordpress.org/Multisite_Network_Administration#Uploaded_File_Path

This article should probably be updated to reflect the change.

alexdo
Site Moderator
Site Moderator badge
March 11, 2024

Thanks for sharing this!

Yes, some of the settings might have changed. I’ll pass this internally so we can ge the tutorial updated.

Regards

<p>As @andrew pointed out…</p> <p> The .htaccess rules referenced above should only be used with WP Multisite installs that started out with WordPress 3.0 through 3.4.2. For WordPress 3.5+ installs, use the rules below; but, ONLY use the rules below if you STARTED Multisite on 3.5. If you upgraded from 3.4 to 3.5, use the old ones referenced above! </p> <pre>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]</pre>

What if I already installed wordpress (and passed step 4) via this guide: https://www.digitalocean.com/community/articles/how-to-install-wordpress-on-ubuntu-12-04

Can I still set up multisite without deleting wordpress and starting over and if so how?

this post did not address the question asked

alexdo
Site Moderator
Site Moderator badge
March 27, 2024

Heya,

Yes, you can still set up WordPress multisite on your existing installation without needing to delete WordPress and start over. Follow these steps to enable multisite on your existing WordPress installation:

  1. Backup Your WordPress Site: Before making any changes, it’s always a good idea to create a backup of your WordPress site, including the files and database.

  2. Edit wp-config.php: Open the wp-config.php file located in the root directory of your WordPress installation for editing.

  3. Enable Multisite: Add the following lines to the wp-config.php file just before the line that says “That’s all, stop editing! Happy blogging.”:

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

  4. Save Changes: Save the wp-config.php file after adding the above lines.

  5. Network Setup: Now, visit your WordPress admin dashboard (http://yourip/wp-admin/) and navigate to “Tools” > “Network Setup”.

  6. Network Setup Wizard: Follow the instructions on the Network Setup page. You’ll need to choose between subdomains or subdirectories for your multisite setup. Enter the necessary information, including the network title and your admin email address.

  7. Update wp-config.php and .htaccess: After completing the Network Setup Wizard, WordPress will provide you with code snippets to add to your wp-config.php and .htaccess files. Follow the instructions to add these code snippets to the respective files.

  8. Save Changes: Save both the wp-config.php and .htaccess files after adding the code snippets.

  9. Log Back In: You’ll be prompted to log in again. Log back into your WordPress admin dashboard.

  10. Activate Multisite: Once logged in, go to “My Sites” > “Network Admin” to access the network admin dashboard. From there, you can manage your multisite network, add new sites, and configure network settings.

Regards

Ok, I went ahead with the steps to configure multisite and it appears to have mostly worked, though I’m now running into this issue: I’ve finished wordpress setup and I have the “My Sites” menu available but when I select “Network Admin” I get a “website unavailable” page; It appears that it’s trying to pull up the address: “youripaddresshere/wp-admin/network”. How do I set that address to my droplets IP or hostname?

alexdo
Site Moderator
Site Moderator badge
March 27, 2024

You’ll need to update all references to match the correct IP address. In order to resolve this you can use plugin like Duplicator or All-In-One-Migration plugin to handle the process for you.

Regards

Sorry to leave another comment but it won’t let me amend my previous one… So I tried pointing my browser directly at myip/wp-admin/network with no luck either— seems like it’s still trying to route to “youripaddresshere/wp-admin/network” even though I’ve put replaced with my IP address and still saying website unavailable.

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.