How to set up WordPress multi site

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:



    • (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.

Select 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:

  1. First we need to set up both our domains:
  2. 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.
  3. Next enter the following information in the create a Subdomain box:

    Root Domain:
    Document Root: public_html/tutorial_examples/blog
    Then Click create
  4. Do the same for:
    Root Domain:
    Document Root: public_html/tutorial_examples/blog
  5. 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:



    1. It does a lot of the tedious set up work for you.
    2. It ensures that the program is installed and set up correctly
    3. 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.
  6. From your cPanel Locate Softaculous and double click on it.
  7. 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.
  8. Enter the following information:
  9. Now go to your sites URL to make sure that the install worked. You should see something like this:
  10. Now that we know that it works, Let's sign into the admin side.
  11. From the admin menu, go to My sites -> network admin -> dashboard
  12. From the left navigation go to Plug ins -> add new
  13. Now we are going to install for the WordPress MU Domain Mapping plug in:
  14. From the plug in search box enter "WordPress MU Domain Mapping" and press search then click install to download and install the plug in.
  15. Then once the plug in loads click on network activate.
  16. This plug in requires special handling,so we need to do the following:



    1. Navigate to: public_html/tutorial_examples/blog/wpcodebase/wp-content/plugins/wordpress-mu-domain-mapping
    2. Copy the sunrise.php to the /public_html/tutorial_examples/blog/wpcodebase/wp-content directory
    3. Open the wp-config.php located at /public_html/tutorial_examples/blog/wpcodebase/wp-config.php and add :
      "define( 'SUNRISE', 'on' );"
      just above the /* That's all, stop editing! Happy blogging. */ line and save the file
  17. 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/’.

  18. In order to fix this we need to change the directory that is pointing to.
    Currently it's pointing to /public_html/tutorial_examples/blog making the /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 to/public_html/tutorial_examples/blog/wpcodebase the plug in will work correctly. We do this by:

    1. From cPanel Go to Sub Domains and look for the entry and click remove

    2. Renter the sub domain with the correct document root of /public_html/tutorial_examples/blog/wpcodebase and click create.

    3. Do the same for as well

  19. Edit the .htaccess file in public_html/tutorial_examples/blog/wpcodebase
  • Change RewriteBase /wpcodebase/ to RewriteBase  /
    (This will update the rewrite path to match the sub domain)
  1. Next we need to edit the wp-config.php in  public_html/tutorial_examples/blog/wpcodebase
  • 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)
  1. Clear your browsers' cache and re-start your browser.
  2. Now log back into the admin at and re-enter your password.
  3. 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)
  4. 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
  5. 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
  6. 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.
  7. The click on domains

    Site ID: 2 (Default for second blog)
    uncheck primary
    Then click on save
  8. You now have 2 separate blogs under 2 separate domains. Remember to keep your single code base of WordPress updated and happy blogging!



Comments are closed.