Codex

Create A Network

As of WordPress 3.0, you have the ability to create a network of sites by using the multisite feature. This article contains instructions for creating a multisite network.

A multisite network can be very similar to your own personal version of WordPress.com. End users of your network can create their own sites on demand, just like end users of WordPress.com can create blogs on demand. If you do not have any need to allow end users to create their own sites on demand, you can create a multisite network in which only you, the administrator, can add new sites.

A multisite network is a collection of sites that all share the same WordPress installation. They can also share plugins and themes. The individual sites in the network are virtual sites in the sense that they do not have their own directories on your server, although they do have separate directories for media uploads within the shared installation, and they do have separate tables in the database.

NOTE: If you are currently running WordPress MU, you do not need to complete these steps. your network is already enabled. Once you upgrade to the 3.x branch, you will be prompted to update your .htaccess rules for MultiSite.
NOTE: Upgraded and can't find the Network Admin menu?

Before You Begin

Contents


This section outlines some requirements to consider before you begin creating a multisite network.

Do you really need a network?

The sites in a multisite network are separate, very like the separate blogs at WordPress.com. They are not interconnected like things in other kinds of networks (even though plugins can create various kinds of interconnections between the sites). If you plan on creating sites that are strongly interconnected, that share data, or share users, then a multisite network might not be the best solution.

For example, if all you want is for different collections of web pages to look very different, then you can probably achieve what you want in a single site by using a plugin to switch themes, templates, or stylesheets.

For another example, if all you want is for different groups of users to have access to different information, then you can probably achieve what you want in a single site by using a plugin to switch capabilities, menus, and link URLs.

Types of multisite network

You can choose between several different types of multisite network depending on how you want your network to handle URLs, and on whether it will allow end users to create new sites on demand.

Different types of network have different server requirements, which are described in a section below. If you do not have full control over your server then certain types of multisite network might not be available to you. For example, you might not have full control over your server because you use a shared hosting environment. In that case you will have to negotiate the requirements with whoever operates the hosting environment.

The sites in a network have different URLs. You can choose one of two ways for the URL to specify the site:

  • Each site has a different domain. For example: example1.com, example2.com, site1.example.com, site2.example.com.
  • Each site has a different path. For example: example.com/site1, example.com/site2

Properties of a site in a network. The site's URL is http://example3.com/

You can also choose whether or not to allow end users to create new sites on demand. Domain-based on-demand sites are normally only possible using subdomains like site1.example.com and site2.example.com. Path-based on-demand sites are also possible.

The multisite installation process uses different terminology. A sub-domain install creates a domain-based network, even though you might use separate domains, and not subdomains, for your sites. A sub-directory install creates a path-based network, even though it does not use file system directories.

After the multisite network installation is complete, WordPress uses the terminology domain and path for each site's domain and path in the Network Admin user interface. A super admin (that is, a multisite network administrator) can edit sites' domain and path settings, although it is unusual to do this to established sites because it changes their URLs.

Plugins can extend the options available and help with administration. For example, you can use the WordPress MU Domain Mapping plugin to help you map individual sites to independent domain names. For another example, you can use the Networks for WordPress plugin to configure multiple networks in the same WordPress installation.

Admin Requirements

To create a multisite network you must be the administrator of a WordPress installation, and you normally need access to the server's file system so that you can edit files and create a directory. For example, you could access the server's file system using FTP, or using the File Manager in cPanel, or in some other way.

You do not necessarily need any knowledge of WordPress development, PHP, HTML, CSS, server administration or system administration, although knowledge of these things might be useful for troubleshooting or for customizing your multisite network after installation.

Server Requirements

When you are planning a network, it can sometimes be helpful to use a development server for initial testing. However, setting up a development server that exactly matches your production server is not always possible, and transferring an entire network to a production server may not be easy. A test site on your production server is sometimes a more useful way to test your planned network.

Some server requirements depend on the type of multisite network you want to create, as follows.

Domain-based

For a domain-based network you require to map different domain names to the same directory in the server's file system where WordPress is installed. You can do this in various ways, for example:

  • by configuring wildcard subdomains
  • by configuring virtual hosts, specifying the same document root for each
  • by creating addon domains or subdomains in cPanel or in a similar web hosting control panel

On-demand domain-based sites require the wildcard subdomains method. You can create additional sites manually in the same network using other methods.

Whichever methods you use require DNS configuration to map the domain name to the server's IP address, and also server configuration to map the domain name to the WordPress installation directory. (WordPress then maps the domain name to the site.)

External links:

For some examples of how to configure wildcard subdomains on various systems, see: Configuring Wildcard Subdomains

Path-based

If you are using pretty permalinks in your site already, then a path-based network will work as well, and you do not need any of the other information in this section.

For a path-based network you normally require mod_rewrite to be loaded on the Apache server, support for it in .htaccess files, and Options FollowSymLinks either already enabled or at least not permanently disabled. If you have access to the server configuration, then you could use a Directory section instead of a .htaccess file.

The requirement is the same for on-demand path-based sites.

Example: Configuring mod_rewrite in an Apache server on Ubuntu Linux.

To really check if mod_rewrite is running, create 'nano /var/www/test.php' and inside that file put '<?php phpinfo(); ?>' then go to your web browser and try loading test.php and search for mod_rewrite in the loaded apache modules.
If not loaded, then use command from cli 'sudo a2enmod rewrite'; 'sudo nano /etc/apache2/sites-enabled/000-default' changing the Allow None to Allow All under the /var/www sections (2 places) and 'sudo /etc/init.d/apache2 restart' Otherwise you won't get sub sites to show up. The above is under Ubuntu server 10.04 with LAMP, other distros will likely be similar (Centos 6.0 also does not have set under default).

WordPress Settings Requirements

When you install a multisite network you start from an existing WordPress installation. If it is a fresh install with its own domain name, then you do not need to read this section. If it is an established site, or not reachable using just a domain name, then the following requirements apply to allow it to be converted to a multisite network.

Giving WordPress its own directory will not work in WordPress 3.0 with multisite enabled. If you wish to install WordPress in a folder AND have that folder name it will work. Domain mapping, however, will not work.

If you have www in the settings for your domain url, and plan to use subdomains for multisite, make sure that both the site address and the WordPress address are the same. If you plan on changing them to domain.com or www.domain.com, do so before you begin the rest of the setup for MultiSite, as changing the domain name after the fact is more complicated.

You cannot create a network in the following cases:

  • "WordPress address (URL)" is different from "Site address (URL)".
  • "WordPress address (URL)" uses a port number other than ':80', ':443'.

You cannot choose Sub-domain Install (for a domain-based network) in the following cases:

  • The WordPress URL contains a path, not just a domain. (That is, WordPress is not installed in a document root, or you are not using the URL of that document root.)
  • "WordPress address (URL)" is localhost.
  • "WordPress address (URL)" is IP address such as 127.0.0.1.

(Note that you can create a domain-based network on your local machine for testing purposes by using your hosts file to map some other hostnames to the IP address 127.0.0.1, so that you never have to use the hostname localhost.)

You cannot choose Sub-directory Install (for a path-based network) if your existing WordPress installation has been set up for more than a month, due to issues with existing permalinks. (This problem will be fixed in a future version. See Switching between subdomains and subfolders for more information.)

(See wp-admin/network.php for more detail)

Step 1: Prepare Your WordPress

Your WordPress site will be updated when creating a network. Unless it is a fresh install and you have nothing to lose, please backup your database and files.

Also deactivate all active plugins. You can reactivate them again after the network is created.

Step 2: Allow Multisite

To enable the Network Setup menu item, you must first define multisite in the wp-config.php file.

Open up wp-config.php and add this line above where it says /* That's all, stop editing! Happy blogging. */. If it doesn't say that anywhere, then add the line somewhere above the first line that begins with require or include:

define('WP_ALLOW_MULTISITE', true);

You will need to refresh your browser to continue.

Step 3: Installing a Network

The previous step enables the Network Setup item in your Tools menu. Use that menu item to go to the Create a Network of WordPress Sites screen.

Tools Network Screen

To see an example of the Create a Network of WordPress Sites screen, look at Administration > Tools > Network Setup. The screen does not look exactly the same in all circumstances. The example shown is for an installation on localhost, which restricts the options available.

Addresses of Sites in your Network

You are given the choice between sub-domains and sub-directories, except when existing settings restrict your choice.

You must choose one or the other. You can reconfigure your network to use the other choice after installation, despite the advice on the screen, but reconfiguring it might not be easy.

You only need wildcard DNS for on-demand domain-based sites, despite the advice that may be on the screen.

See also Before You Begin.

  • Sub-domains — a domain-based network in which on-demand sites use subdomains
  • Sub-directories — a path-based network in which on-demand sites use paths

Network Details

There are filled in automatically, but you can make changes.

Server Address
The domain of the URL you are using to access your WordPress installation.
Network Title
The title of your network as a whole.
Admin E-mail Address
Your email address as super admin of the network as a whole.

Double-check the details and press the Install button.

Note: The installer may perform a check for wildcard subdomains when you have not configured them yet, or when you do not need them at all. Ignore the warning if it does not apply to your network. See Server Requirements above for information about wildcard subdomains.

Step 4: Enabling the Network

Tools Network Created

To enable your network, follow the instructions on the Create a Network of WordPress Sites screen. The instructions that you see are customized for your installation. They might not be the same as the examples you see here.

Back up your existing wp-config.php and .htaccess files, unless this is a fresh install and you have nothing to lose.

There are three steps:

1. Create a directory for media file uploads
This directory must be writable by the web server, the same as your wp-content directory.
2. Add the specified lines to your wp-config.php file
The extra lines go just after where you added the line in Step 1: Prepare Your WordPress.
3. Add the specified lines to your .htaccess file
If you do not have a .htaccess file, then create it in the same directory as your wp-config.php file.
In some cases you might also have to add Options FollowSymlinks at the start of the file.

After completing these steps, log in again using the link provided. You might have to clear your browser's cache and cookies in order to log in.

Step 5: Network Admin Settings

Network Admin

At the left of your WordPress toolbar, My Sites is now the second item. There, all your sites are listed, with handy fly-out menus, as well as a Network Admin menu item. Under Network Admin you can use the Dashboard item to go to the Network Dashboard screen.

Go to the Settings Screen to configure network options, and the Sites Screen to manage your sites.

For more information, see: Network Admin

? Upgraded and can't find the Network Admin menu?


Things You Need To Know

Here are some additional things you might need to know about advanced administration of the network.

User Access

By design, all users who are added to your network will have subscriber access to all sites on your network. To allocate a different default role for users on individual sites, you must use a plugin, such as Multisite User Management.

The capabilities of the site administrator role are also reduced in a WordPress Network. Site admins cannot install new themes or plugins and cannot edit the profiles of users on their site. Only the Network Admin (aka Super Admin) has the ability to perform these tasks in a WordPress network.

Permalinks

While permalinks will continue to work, the main site (i.e. the first one created) will have an extra entry of blog, making your URLs appear like domain.com/blog/YYYY/MM/POSTNAME.

This is by design, in order to prevent collisions with SubFolder installs. Currently there is no easy way to change it, as doing so prevents WordPress from auto-detecting collisions between your main site and any subsites. This will be addressed, and customizable, in a future version of WordPress.

Also note that the blog prefix is not used for static pages which will be accessible directly under the base address, e.g. domain.com/PAGENAME. If you try to create a static page in the first site with the name of another existing site on the network, the page's permalink will get a suffix (e.g. domain.com/PAGENAME-2). If you create a new site with the slug of an existing static page, the static page will not be reachable anymore. To prevent this, you can add the names of your static pages to the blacklist so that no site with that name can be created.

WordPress Plugins

WordPress Plugins now have additional flexibility, depending upon their implementation across the network. All plugins are installed on the network dashboard's plugin page, and can be activated per-site or for the entire network.

  • Site Specific Plugins: WordPress Plugins to be activated or deactivated by an individual site admin are stored in the plugins directory. You need to enable the Plugins page for individual site administrators from the Network Admin's Settings -> Network Settings menu. Specific site administrators can then toggle optional plugin activation.
  • Network Plugins: WordPress Plugins that are also stored in the plugins directory can be activated across the entire network by the super admin. Once 'Network Activated' plugins will become active in all sites. 'Network Activated' plugins are hidden entirely from per-site plugin lists.
  • Must-Use Plugins: Plugins to be used by all sites on the entire network may also be installed in the mu-plugins directory as single files, or a file to include a subfolder. Any files within a folder will not be read. These files are not activated or deactivated; if they exist, they are used. These plugins are hidden entirely from per-site plugin lists.

WordPress Themes

All themes are installed for the entire network. If you edit the code of one theme, you edit it for all sites using that theme. You can install the plugin WordPress.com Custom CSS to allow each site to tweak their own CSS without affecting anyone else. You can activate themes for the entire network, or edit sites and activate them individually.

By default, WordPress assigns "Twenty Eleven" as the theme for all new sites. This can be customized by adding a line like define('WP_DEFAULT_THEME', 'classic'); to your wp-config.php file, where 'classic' is replaced with the folder name of your theme.

Categories and Tags

Global terms are disabled in WordPress 3.0 by default. You can use the Sitewide Tags WordPress Plugin or other similar Plugins to incorporate global tags on the portal/front page of the site or on specific pages or sites within the network to increase navigation based upon micro-categorized content.

Switching network types

It's possible to switch between domain-based (sub-domain) and path-based (sub-directory) installations of Multisite. If you have had WordPress installed for longer than a month and are attempting to activate the network, you will be told to use Sub-domain sites. This is in order to ensure you don't have conflicts between pages (i.e. example.com/pagename ) and sites (i.e. example.com/sitename ). If you are confident you will not have this issue, then you can change this after you finish the initial setup.

In your wp-config.php file, you'll want to change the define call for SUBDOMAIN_INSTALL:

For a domain-based network (sub-domain install)
define( 'SUBDOMAIN_INSTALL', true );
For a path-based network (sub-directory install)
define( 'SUBDOMAIN_INSTALL', false );

You'll also have to change your .htaccess to the new setup.

Note that per the Settings Requirements you cannot switch from Sub-directory to Sub-domain when running on 127.0.0.1 or localhost. This can potentially cause an endless loop of reauth=1 on your root site due to cookie handling.

Apache Virtual Hosts and Mod Rewrite

To enable mod_rewrite to work within an Apache Virtual host you may need to set some options on the DocumentRoot.

<VirtualHost *:80>
  DocumentRoot /var/www/vhosts/wordpress
  <Directory /var/www/vhosts/wordpress>
    AllowOverride Fileinfo Options
  </Directory>

In some instances, you will need to add All to your AllowOverride for all htaccess rules to be honored.

.htaccess and Mod Rewrite

Unlike Single Site WordPress, which can work with "ugly" Permalinks and thus does not need Mod Rewrite, MultiSite requires its use to format URLs for your subsites. This necessitates the use of an .htaccess file, the format of which will be slightly different if you're using SubFolders or SubDomains. The examples below are the standard .htaccess entries for WordPress SubFolders and SubDomains, when WordPress is installed in the root folder of your website. If you have WordPress in it's own folder, you will need to change the value for RewriteBase appropriately.

As a reminder, these are EXAMPLES and work in most, but not all, installs.

SubFolder Example

# BEGIN WordPress
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]
# END WordPress

SubDomain Example

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# uploaded files
RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule . index.php [L]
# END WordPress

Issues with old WPMU installs

If you installed Wordpress MU in subfolder/subdirectory (not in root folder on your server via ftp) and you have problem with image library, where thumbnails and images do not show, you may need to manually add in rewrite rules for your file directories as follows:

RewriteRule ^([_0-9a-zA-Z-]+/)?siteN/files/(.+) wp-content/blogs.dir/N/files/$2 [L]

Put those below the normal call for uploaded files.

Network Admin Link Location

The Network Admin Link has moved with each major release of WordPress, as this is still a work in progress. Depending on which version of WordPress you are using, the link can be found in the following locations:

  • 3.0 - A menu called Super Admin
  • 3.1 - On the admin header by "Howdy, YOURNAME."
  • 3.2 - On the admin header, as a drop-down under "Howdy, YOURNAME."
  • 3.3 - On the admin bar, as a drop-down under your "My Sites"

Importing into WordPress Network

When you've created your WordPress Network for importing other sites, you need to look at the Migrating Multiple Blogs into WordPress Multisite article.

Related Articles