One of the essentials of keeping your clients websites constantly updated with new content is a blog site. This allows your client with little or no web knowledge to add new content to their blog site by themselves. But if you include a WordPress blog with each static site, what is the best way to maintain them? If you have say 20 different customers, do you really want to maintain 20 different WordPress code bases?
Enter WordPress multi-site. As of version 3.0 you can enable multi-stite from within WordPress as opposed to using a custom module or other modifications. While there reasons both for and against using multi-site discussed on other sites that I researched, for my purposes including a small blog with every site made multi site the best option.
So how do we start?
First of all, it's best to start from scratch with a clean installation of WordPress. But if not there is an import / export feature that we can use to get most of our information from our old installation. (This was the method I used)
For this tutorial I'm going to assume you have the following:
- cPanel back end
- Linux web server that's able to run WordPress 3.4.1 that's the current version as I'm writing this.
We have 2 blogs that we want to set up:
- blog1.aandgwebtech.ca (Our main blog)
Our code base is located at
/public_html/tutorial_examples/blog/wpcodebase/* I know that this is incorrect, but I'll show you how to fix this later.
blog1.aandgwebtech.ca from the Choose Domain dropdown
Enter wpcodebase in the In Directory text box
Also most importantly of all, set the admin username and password to something other than the defaults and select Enable Multi site (WPMU)
Then click on install. In a few minutes your site will be installed
If everything goes as planned you'll see the following message:
- First we need to set up both our domains:
From your cPanel locate the SubDomains icon and double click on it. (A similar procedure can be used for either add on or parked domains as well.
Next enter the following information in the create a Subdomain box:
Then Click create
Do the same for:
Install WordPress from your cPanel program auto installer. In the case of my webhost they used Softaculous to automatically install. If your web host has a auto installer like Softaculous I'd strongly recommend using it because:
- It does a lot of the tedious set up work for you.
- It ensures that the program is installed and set up correctly
- It comes with a back up feature to allow you seamless back up both the directory and the data. Most importantly of all, you can easily roll back to a previous back up if something goes horribly wrong. While not an issue in WP other CMS systems can be trashed with the errant click of a mouse.
From your cPanel Locate Softaculous and double click on it.
- The front page will have the top scripts, WordPress will of course be one of them so double click on it and then click on install.
- Enter the following information:
Now go to your sites URL to make sure that the install worked. You should see something like this:
- Now that we know that it works, Let's sign into the admin side.
- From the admin menu, go to My sites -> network admin -> dashboard
- From the left navigation go to Plug ins -> add new
- Now we are going to install for the WordPress MU Domain Mapping plug in:
- From the plug in search box enter "WordPress MU Domain Mapping" and press search then click install to download and install the plug in.
- Then once the plug in loads click on network activate.
This plug in requires special handling,so we need to do the following:
/public_html/tutorial_examples/blog/wpcodebase/wp-config.phpand add :
"define( 'SUNRISE', 'on' );"
just above the
/* That's all, stop editing! Happy blogging. */line and save the file
- Navigate to:
Now lets check to make sure that our plug in works. From the left hand navigation menu go to settings -> domain mapping
But we receive the following error:
Warning! This plugin will only work if WordPress is installed in the root directory of your webserver. It is currently installed in ’/wpcodebase/’.
In order to fix this we need to change the directory that
blog1.aandgwebtech.cais pointing to.
Currently it's pointing to
/wpcodebase/a sub directory. But in order for the WordPress MU Domain Mapping to work correctly it needs to be in the root directory. So if we change the document root for
/public_html/tutorial_examples/blog/wpcodebasethe plug in will work correctly. We do this by:
From cPanel Go to Sub Domains and look for the
blog1.aandgwebtech.caentry and click remove
blog1.aandgwebtech.casub domain with the correct document root of
/public_html/tutorial_examples/blog/wpcodebaseand click create.
Do the same for
(This will update the rewrite path to match the sub domain)
Next we need to edit the
Go to the end of the file and locate the line
"define( 'PATH_CURRENT_SITE', '/wpcodebase/' );"change this to
"define( 'PATH_CURRENT_SITE', '/' );"
Locate the line
"$base = '/wpcodebase/';"and set it to
"$base = '/'"
Save the file
(This sets the path to main site to match the root directory that we set for the sub domain)
- Clear your browsers' cache and re-start your browser.
Now log back into the admin at
http://blog1.aandgwebtech.ca/wp-admin/and re-enter your password.
- From the top navigation menu go to Network -> My Sites -> Network Admin -> Dashboard (If you get a database connection re-set the 'PATH_CURRENT_SITE to '/wpcodebase/' and resave wp-config.php)
From the left navigation menu Go to Sites -> Add New and input the following information:
Path: /blog2/ (We need this to separate one blog from another)
Select update siteurl and home as well
- Now from the left navigation menu go to Settings -> Domain mapping (If you had to re-set the 'PATH_CURRENT_SITE in wp-config.php change it back to "define( 'PATH_CURRENT_SITE', '/' );" before continuing or else you will receive an error
Enter your web servers' IP address (It's shown in cPanel) in the Server IP address text box as well as checking options 1-4 under domain options and click save.
The click on domains
Site ID: 2 (Default for second blog)
Then click on save
You now have 2 separate blogs under 2 separate domains. Remember to keep your single code base of WordPress updated and happy blogging!
- http://codex.wordpress.org/Migrating_Multiple_Blogs_into_WordPress_3.0_Multi site