The Multisite Network feature of WordPress lets you host more than one site using a single installation. I will walk you through the steps involved in the setup and then guide you through some basic functions for the maintenance of the network. I am executing this example on a localhost environment on a windows based machine. So, along with the online web server specific settings, I will also detail the steps specific to a localhost hosting environment.
For the scope of this tutorial, let us consider an example requirement that the url of my website is middlearth.com.
Now, I need to setup multisites say, one each for Elves, Hobbits, Dwarfs and Humans, using the same base installation of WordPress that I have on middlearth.com
While I use the middlearth.com to host content about the history and facts of the realm, I want the primary races to have their own websites to put up their blogs and other content specific to each.
I have a choice to offer them their sites using sub-domains or Sub-directories.
Sub-domains or Sub-directories?
I have two choices, either I deploy the multisites for each of the races using sub-domains such as
or deploy the multisites into respective Sub-directories such as
- http://middlearth.com/hobbits etc.
If we use Sub-domains
If we choose to go with a structure based on sub-domains, then we need to know a few things.
Make sure, that your DNS records have an entry for your sub-domains pointing to the same IP as the main domain.
Or use a wildcard entry to point all sub-domain to the IP address of the hosting.
In case you working on a local hosting environment, you can have the domains and sub-domains point to 127.0.0.1 in the hosts file.
Also make sure that the sub-domains are added to your hosting as aliases or add on domains and they point to the same directory as the main domain i.e., middlearth.com for our example. This facility is usualy provided in the control panels of the hosting packages.
In case you working on a local hosting environment, you can edit the configuration to specify sub-domain as aliases. Here is an example using Apache’s configuration.
In the main config file say httpd.conf, uncomment the following
Next, edit the conf/extra/httpd-vhosts.conf file to include a virtual host entry as the following example
<VirtualHost *:80> ServerAdmin firstname.lastname@example.org DocumentRoot "/var/www/vhosts/middlearth/httpdocs" ServerName middlearth.com ServerAlias *.middlearth.com ErrorLog "logs/middlearth.com-error.log" CustomLog "logs/middlearth.com-access.log" common </VirtualHost>
The ServerAlias has the value of *.middlearth.com. This means that any sub-domain having the top level domain as middlearth.com will be directed to the same DocumentRoot as of the main domain.
If you do not want to use wildcards and want to be specific about particular sub-domains only, then you can have the complete sub-domains provided as the value for the ServerAlias property. The multiple sub-domains should be separated by a space.
Note: You will need to re-start Apache after you make the above changes.
Starting the Multi site setup.
Open the wp-config.php in your base WordPress installation in your favorite code editor.
Add the following line just above where it says “That’s all, stop editing! Happy blogging.”
define('WP_ALLOW_MULTISITE', true); /* That's all, stop editing! Happy blogging. */
This piece of code in the configuration directs the WordPress to provide a link to initiate setup for the network. Once, you have the above piece of code in place. Log into the WordPress dashboard middlearth.com/wp-admin as an admin.
Under the Tools menu, you will find a sub menu item “Network setup”
Click on it and you will be presented with the first dialog screen where you have to specify your choice between using sub domains or sub directories.
Once you have provided the required information and proceed to the next step, you will be presented with some code snippets that you manually need to insert into the wp-config.php file as well as the .htaccess.
Editing the wp-config.php once more
The first snippet is meant to be inserted to the wp-config.php file, just before the “”
At this point, you can take out the definition for “WP_ALLOW_MULTISITE” that we inserted previously and replace it with the the provided code snippet.
The first line defines the ‘MULTISITE’ constant to be true.
Then the second line specifies if the Multisite structure is deployed using sub domains or sub directories. In the above example case, it is deployed using sub domains.
The next line defines the domain of the main website, in our example it is middlearth.com. Note that, ‘CURRENT_SITE’ signifies the main site.
Similarly, the next line defines the path for the current site.
The last two lines define the site ID and blog ID for the Current site. By default we specify the IDs for the Current site to be 1, as we add more sites to our network later, their IDs will be assigned as 2, 3, ..and so on.
Editing the .htaccess
The code provided for .htaccess is supposed to replace any previous code existing in the file.
Once you have done the above edits, your WordPress website is ready to accommodate more sites in its multisite network.
Log off and re-login once again.
To manage the multisite network, you have to be at the Dashboard of the Network Administrator.
To switch to the Network Administrator’s dashboard you can click on “My Sites” on the admin bar, and then Network Administrator > Dashboard
At this point, you can see all the options available for managing the Multisite network.
Adding sites to your network
Click on “Sites” on the left menu. This will show you the list of all the sites present in your network.
Click on “Add new” to add a new site to the network.
Removing sites from the network
From the menu options itself on this screen, you can delete the existing sites from your network.
Themes on a Multisite Network
The Installation and removal of themes on a multisite network should be done from the Dashboard of the “Network Administrator”
When you go to the “Themes” page from the side menu, you get the options to setup or remove themes the same way as on a standalone WordPress website.
Network Enable the themes
If you have Network Enabled a theme, that means it will be available for all the sites on the multisite network, and will show up in “themes” section of the dashboards for each of the sites. You can simply activate or deactivate it from the site’s dashboard.
Enable theme for a particular site on the network
You can have the themes disabled for the network so that they are not available for all the sites on the network.
You can selectively enable a theme for a particular site on the network from the “Network Administrator” dashboard.
Click on particular site in the site’s list and then hit the “Themes” tab.
Here you can enable/disable the themes selectively for that particular site.
If a theme is selectively enabled for a particular website, it will show up in the “Themes” section of the dashboard of that site and you can activate and deactive it from there.
Plugins on a Multisite Network
Just like the themes, you can add or remove plugins from the “Network Administrator” Dashboard.
To have any plugin be activated for all the sites on the network, it can be “Network activated” from the plugins page of the Network Administrator’s dashboard.
You can also selectively activate a plugin for particular site, from the plugins page of that particular site’s dashboard. Note that if some plugin is “Network activated” by the network administrator, it will not show up in any particular site’s dashboard although it will be effectively working for all the sites.