How to Install & Setup WordPress Multisite

Since version 3.0, you  had the option to activate “WordPress Multisite,” which is great considering that it allows you to run as many sites as you want from a single WordPress installation (whereas previously it was one website per WordPress installation).

If you run a lot of sites, or you have lots of clients that you keep websites for, it can be a lot of maintenance to go to each one individually and update them on a regular basis. With WordPress Multisite, you can update all the plugins and themes with just one click, which is a huge time-saver. I currently run a network of about 20 sites and it makes it so much easier to keep everything updated. You could have a much larger network of sites and it would be no more difficult to update them all. Not to mention that, when you have a bunch of WordPress sites running on a single web server, it can slow everything else down. Having only one installation means less resources are being drained on your web server.

The benefits of WordPress Multisite are massive and I thoroughly recommend it to anyone who wants to run more than one site, unless there is a very good reason for keeping the sites separate from one another.

If you find this tutorial a little too daunting,  hire me to do it for you. However, if you’re comfortable fiddling with code, here is how to do it.

WordPress Multisite Step 1: Back Everything UP!!!

You’re about to be making some significant changes to your core files and in particular, your database, so be sure to take a thorough backup of both even if you automate your database backups. This is standard procedure and “I pity the fool” who doesn’t back everything up prior to updating core files.

WordPress Multisite Step 2: Allow Multisite Installation

To avoid dangerous mistakes, you need  to intentionally enable the option to even install multisite. Fortunately, it doesn’t require much of you. Hunt down your wp-config.php file which should be in the root of your WordPress installation, find the “stop editing” line and insert the following line just above it, like so:

define('WP_ALLOW_MULTISITE', true);

/* That's all, stop editing! Happy blogging. */

WordPress Multisite Step 3: Setup the network

Now when you refresh your WordPress admin, you’ll see an additional option under the Tools menu called Network Setup. Head there. You’ll be presented with a few options, like what to call your network and the email address of your Super Admin (see A Quick Guide to User Roles). You may also be presented with the option to choose between sub-directory or subdomain installation. Unless you desperately want a subdirectory installation, I would strongly suggest subdomain installation. Fill the options out and hit the big old install button (but only if you promise me that backed up your site first).

WordPress Multisite Step 4: Enable the network

Now that your database is ready to get the network going, you need to edit a couple more files to make the network active. Fortunately, the clever WordPress monkeys made it very explicit and easy for you to understand.

After setting up the network, you should be presented with a page that shows you a few blocks of code. Enabling the network involves adding some code to two files: wp-config.php and .htaccess, both of which should be in your website’s root folder. The code for your wp-config.php will look something like the code below:

define('WP_ALLOW_MULTISITE', true);
define( 'MULTISITE', true );
define( 'SUBDOMAIN_INSTALL', true );
$base = '/';
define( 'DOMAIN_CURRENT_SITE', 'wpsites.rafihecht.com' );
define( 'PATH_CURRENT_SITE', '/' );
define( 'SITE_ID_CURRENT_SITE', 1 );
define( 'BLOG_ID_CURRENT_SITE', 1 );

/* That's all, stop editing! Happy blogging. */

WordPress Multisite Step 5: Add a Wildcard Subdomain (optional)

At this point, you should also enable a “wildcard subdomain” in your hosting account, which will allow WordPress to use whatever subdomain it needs to create all the different sites. I’m going to show you how to do this in cPanel, since this should be available to most of you (especially if you use HostGator).

Once logged in to cPanel, hit the Subdomains icon. You’ll then have a small form that will enable you to add a new subdomain (above any subdomains that might already exist). Create a new subdomain of * on the domain of your WordPress master site, setting the document root as public_html, or wherever the root of your website is, if it’s not there.

Once you’ve successfully done that and added all the code that WordPress asks you to, you’ll need to login again. There should be a link at the bottom of the Network setup page. Click there and log back in, where your new multisite-enabled site will be waiting for you.
Note: this is optional as not every host, such as GoDaddy, will have the option to add a wildcard subdomain for security reasons. In that case you can always just do “wpsites.rafihecht.com/foo.”

WordPress Multisite Step 6: Tweaking your settings

How you set up your network will largely depend on how you want to run it. For example, on my network, I don’t want to allow anyone to be able to create their own site, though that is an option if you want to do that. I also don’t want to limit what kind of files can be uploaded (since I’m in charge of all the sites), or what size they can be, though if you have a more open network, you may want to put some of those restrictions in place.
To modify your network settings, you’ll need to go to the newly created Network Admin area; your original WordPress site will continue to have it’s own admin area, but there will be a new overarching Network Admin Area where you can install themes, plugins and add new sites and users from. To access it, you can go to the admin bar and find it under the My Sites menu. You can also go to yourdomain.com/wp-admin/network to get to the Network Admin area.

Once you’re at the dashboard, you can find the network setup page under Settings > Network Settings. Just have a good look through at everything and set up the options as you see fit for what your network needs are. You can of course change them if they are too strict or lax in the future.

If you’re going to disable new site registrations, so that only a Super Admin can create new sites, you might want to add another declaration to your wp-config.php file, just below all the ones you pasted earlier. This will redirect people to a specified site if they try to access a site that doesn’t exist (presumably your master site). For example, since I have the following declaration in my wp-config.php file, anyone trying to access wpsites.rafihecht.com/rjhsolutions, which does not exist, will be redirected to wpsites.rafihecht.com:

define( 'NOBLOGREDIRECT', 'http://wpsites.rafihecht.com');

WordPress Multisite Step 7: Adding a new network site

Now that your network is all set up, you’ll probably want to add your first network site. Doing so is a fairly simple process. Go to the Add New option under the Sites menu in your Network Admin area.

The process of adding the site is incredibly simple. Just three pieces of information are required of you; the site address, which is where your site will be accessed from. For example, if I was going to create a site at wpsites.rafihecht.com/parties, I would simple insert parties in this field.

You’re then asked for the Site Title and finally the Administrator’s email. If you want to add yourself as the site’s admin, just enter the same email address that you used in your existing profile. Alternatively, you can set it as someone completely new.

Once you click on Add Site, it will create the site for you and you are then given the option to go to the Dashboard, or Edit the Site. Simple huh!?

How about using custom domains for my new sites?

As you’ll have noticed, everything up to this point has allowed you to create new sites as subdomains to the Network Master Site, where you installed Multisite. But what if you want to use custom domains for your new sites? For example, I have WordPress Multisite installed on rafihecht.com, but RJH Solutions is a network site from that installation, even though it’s domain (doitwithwp.com) is not a subdomain of rafihecht.com.

Well, I’ve written a tutorial that walks you through that process. If you’ve gotten this far, it’s only a small step to be able to use individual domains for your network sites. Go ahead and read How to Set Up Domain Mapping for WordPress Multisite.

Content of this part of the blog post was courtesy of doitwithwp.com.

Meta-tutorial: How to Disable Multisite Once it’s on

Let’s say you made a mistake during the enabling process, but only figured it out in the end. Perhaps you realized after setting it up as a subdomain network that your host doesn’t have wildcard subdomain support and now you’re out of luck. Perhaps you would only like to run through the process again, to show someone how to do it or to work up a tutorial (like me!). Here’s how to un-do the network:

Only undo your multisite setup if you’re comfortable looking at things like this. Otherwise, just restore from your backups.

  1. First you will want to remove the lines you added to wp-config.php, so that it appears as it did before you started the network setup. Since these lines are all right next to each other, this should be simple enough.
  2. You will need to remove what you added to your .htaccess file as well, returning it to its previous version. If you have made no further customizations to your .htaccess file other than what you did with the network setup, than you can simply delete the .htaccess file.
  3. Delete your /blogs.dir directory within the /wp-content folder. This held all of your site’s uploads (but not your primary site, those are still in /wp-content/uploads).
  4. Finally, you will need to remove a few tables in your database. Open up phpMyAdmin and delete the following rows: every wp_#_ row (these were created for each of your sites, and the number of them depends on how many sites you created) and wp_blogs,wp_blog_versions, and wp_site. This will remove all of the tables created during the multisite setup process.

Of course, since you made a backup of your site before enabling multisite, you can always revert to your old database and files if you need to. This is just another way to achieve the same thing.

You will know this process works when you log back in and the Super Admin menu is gone. Now you can re-create your network, or continue on in single-site WordPress bliss.

Content of this part of the blog post was courtesy of : http://wpcandy.com/teaches/how-to-enable-multisite

 

Comments

comments

Recent Posts