Ever since version 3 of WordPress was launched, users had the ability to create a network of WP sites or blogs, allowing us to own a site similar to WordPress.com.
Using what’s called the ‘multisite’ feature we could have many sites running, only having just one installation of the software installed. There is just one database with unique tables created for each install. Also there is just one set of files but with separate folders for media uploads.
Read the what is WordPress multi-site article for more details on WPMS.
Is A Network Even Necessary?
A lot of times a network of sites is not even needed. There are clear reasons like if wanting to allow other people to have their own blog on the network. But, if wanting to have separate “sections,” like a forum, that could often be accomplished with plugins on the main install.
An example of a network that I setup recently where I felt a multisite was necessary was for a raw foods site. I had the main site/blog and then branch off sites for newsletter archives (do this, trust me, this is a huge traffic magnet and a way to keep fresh content constantly whilst communicating with your list regularly too), a WP site setup for landing pages for paid traffic, and also a q&a setup, plus more. Basically anything that I wanted to use a different theme for I rolled out an add-on site. Granted, you could get creative with templates but I wanted physical differentiations between my raw food “sites” on the same domain.
If you are just trying to create different sites for different geographic locations for example, a multisite environment might not be necessary. There are plugins that exist that allow you to determine the location of a visitor allowing you to redirect to a different page or show completely different content to that visitor.
There are also theme switchers available, so be certain that you really need a network before continuing on.
Subfolders Are OK, Subdomains Are Better
At the beginning of the process you will be asked whether you want to use subdomains or subfolders for the WordPress Network. What this means is for every new site it will determine the address for it based on your selection.
For subdomains: site1.example.com, site2.example.com
For subfolders: example.com/site1, example.com/site2
I personally like to use subdomains. The reason is because the subfolder style is used for post/page name slugs in the way I set my Permalinks. Meaning, if I created a post called “archives” on the root/main site the path to the post would be:
Now, if I decided to create a site with the same name there would be a conflict and one would end up with a “-1” appended to it. Truth be told, it is unlikely that a conflict will arise. But I still prefer to let the subfolder structure belong to the main site’s post/page slug, rather than share that structure with site names. I hope that makes sense.
When choosing subdomains though there is an extra step required that needs to be performed on the server. The exact procedure differs depending on the web host and the Operating System and software used on the server.
When creating a new site using a subdomain, the subdomain has to virtually point to the root site at the server level so that your WordPress Network installation knows what tables in the DB to pull the cotent/config from. While this can be done manually it is sometimes easiest, and in some cases necessary, to create a wilcard subdomain that points to the root.
For example: *.example.com would link to the server path containing the files for your main WordPress installation.
For more information on sub-domain wildcard configuration see: Configuring Wildcard Sub-domains
The above link, at the time of this writing, presents examples for setting up wildcard subdomains for Apache, CPanel, Plesk, DirectAdmin panel, and Amazon Web Services.
Steps For Setting Up A WordPress Network
WordPress Multi-Site Installation Video Tutorial
1) Backup your database and files, deactivate your plugins
How and what to backup is a matter of opinion and personal preference, and only applies when converting an existing site to a Network.
The steps in the video cover a new installation but I thought I would share this link which has a good list of plugins to use and you will find one to back up WordPress (any WordPress backup plugin will do).
You should also deactivate any plugins before proceeding.
2) Install WordPress if necessary
If working with a fresh install of WordPress then naturally you will need to set that up first. You follow the procedure like you would for any normal WordPress install.
You can either use the “1-click” install option if available (look for Simple Scripts or Fantastico in the Control Panel of your web server) or install WordPress manually.
Here is a quick overview for installing manually:
a) Download installation package from WordPress.org
b) Prepare the domain/add-on hosting if necessary
c) Create a MySQL database and user and pair them together with all priveleges
d) Rename wp-config-sample.php to wp-config.php and edit it to add values for the database, user, host, etc.
e) Upload the files and run the install
3) Turn on Multsite in wp-config.php
Step 3 involves telling WordPress that you do in fact want to run a Network. After doing so you are presented with a new option in the left-side menus in the WordPress Dashboard.
To turn it on you define a constant in the wp-config.php file. First, download the file to your computer and open it with a Text editor.
A great place to add the new line is just above the line that reads:
/* That’s all, stop editing! Happy blogging. */
Add the following:
/* Multisite */
Now, after a browser refresh the new menu item called Network Setup should be present under the Tools menu.
4) Install the WP Multisite Network
Now in this step you go through the configuration of the network and set the values.
Go to Tools >> Network Setup
Next you want to make a choice between subdomains and subfolders. Read the section above for more information on that, and the extra step that may be required when choosing subdomains.
Choose an overall Title for the Network.
Edit the Admin Email Address if necessary.
Click the blue Install button at the bottom of the screen.
5) Add the new “define” statements to wp-config.php
In this step you will be presented with some extra statements that will need to be added to the wp-config.php file.
You can locate the statement added previously and just paste these new lines beneath or above it.
These lines reflect the choices made in the previous step, particularly the subdomain vs. subfolder choice that was presented.
6) Add the new “rules” to .htaccess
There may be a .htaccess file that exists in the root of your WordPress site. If there isn’t one, you can create one manually. To do that, open a text editor and save a blank file with an “empty” filename and the extension “htacess” without quotes.
There may be existing lines in the file if one was created previously by WordPress. If so, those lines will be clearly marked that they were included by WP. Overwrite those (and only the ones created by WP) with the new lines presented in the lower text panel of this page.
Setting Up A Wilcard Subdomain in cPanel
In the video I walk through setting up wilcard subdomains in CPanel on HostGator. Also, in the section above I give an overview of the process and it’s purpose. I also presented a link with instructions for a variety of hosts or host types.
Since the procedure was included in the video, here are the steps to create a wildcard subdomain in CPanel. I am specifically doing this in HostGator but that shouldn’t make a great deal of difference as long as CPanel is being used.
1) Go to Domains >> Subdomains
2) Put an asterisk * (Shift+8) in the “Subdomain” box and then choose the domain you are working with
3) The document root will be created automatically but it may be inaccurate if you are working with an add-on domain. Essentially you want to point it to the folder that contains your wp-config.php file. Use a “server” path, not a “web” path.
4) Click the “Create” button.
Creating A New Site On The WordPress Network
Once everything is setup and configured you will be presented with new menu options in the left side and on the top if you have the menu bar turned on.
To add a new site, one way is to:
1) In the top menu bar go to My Sites >> Network Admin >> Sites
2) Not only will this show you a list of existing sites (most likely just the main one at this stage) it will also expand the menu on the left side that has an “Add New” option. Clicking that will naturally bring up the option for adding a new site to the Network.
3) Fill in the Site Address (the option here will be based on the choice made in the subfolder vs. subdomain section), the Site Title, and Admin.
That should do it.
If you want to setup WP multi-site on a localhost using XAMPP then check this tutorial.