One could say I’m a fan of WordPress Multisite. I have done my best to convince people to start using multisite at WordCamp Detroit, WordCamp MSP, and of course on this blog. I’ve focused to convincing WordPressers to take the dive in and get rolling with it, due to how it can speed up development time and overall make your time spent with WordPress more efficient. In short, you should be using WordPress Multisite.
But I’ve never written up a guide to setting up multisite. Today we change that. We’re going to look at how to turn multisite on, what to consider regarding the initial configuration, and then what to do once you’ve finished.
Let’s get started!
This tutorial assumes that you already have WordPress installed, whether locally or on a hosting account of some sort. And while it is always the case, it’s worth repeating here: back up your site before beginning this tutorial.
Step 1: Add
define('WP_ALLOW_MULTISITE', true); to your
So yes, we’re going to be doing a few edits to WordPress files. Don’t worry, these are entirely safe edits to make.
We have to tell WordPress to show us directions for setting up multisite. to do this, we’re going to open up
wp-config.php and add this line:
That line should go right before the line that says:
/* That's all, stop editing! Happy blogging. */
With that added, your code will look something like this:
Step 2: Visit the new “Network” item under the Tools menu
It’s installation time. With that line added we can log back into WordPress and look for a “Network” item under the Tools menu.
This screen will walk us through the remaining setup steps. First you will need to decide:
- Subdomain sites? (sitename.mainsite.com)
- Subfolder sites? (mainsite.com/sitename)
This is an entirely personal choice, of course. Keep in mind that if you choose the subdomain install option you host will need to have wildcard subdomains enabled. If wildcard subdomains aren’t enabled (and on some hosts they won’t be, ask if they are) then this setup won’t work.
You will also need to set network details like the title of your network and the admin e-mail address.
Once you’ve read the page and made your choices, click “Install” and we’ll move to the next step.
Step 3: Create
/blogs.dir folder; copy and paste to
Next, as WordPress will direct you, create a
/blogs.dir folder in your wp-content folder alongside the themes and plugins folders. This will be used by WordPress to manage uploaded files to each of the soon-to-be-created WordPress sites on your network.
There are two more steps needed to set up your network, but they are pretty similar. The screen WordPress shows you next will give you all the information you need. First there will be a selection of text you need to copy into your
wp-config.php file, followed by text to copy into your .htaccess file.
You’ve already edited your
wp-config.php file once, so just do it again, adding the lines WordPress gives you directly beneath what you added before.
If you’ve never edited your
.htaccess file before, it should be located in the root of your WordPress folder. If you don’t see the file, feel free to create the file and add the copied text to it.
Note: if you have previously modified .htaccess for some reason (some plugins and techniques require it) then make sure you don’t erase those changes. If you have modified your
.htaccess file before, it’s your responsibility to keep it straight now.
All done with those changes? Great, you’re almost there!
Step 3: Log in again
With the changes in step 2 made, you will likely need to log into your Dashboard again. Do so, and then look for anything different. Notice the Super Admin menu? If you do, congratulations you have enabled multisite!
So, what now?
Step 4: Create your first “Site”
Let’s go ahead and create our first WordPress “Site”. Head to “Sites” under the Super Admin menu. Use the form on this page to create another WordPress site, either by subdomain or subdirectory (depending on your earlier choice). Create the site and visit it. Check out its Dashboard. Get a feel for how this new process works, because trust me, you won’t want to go back to a standard WordPress installation now.
Now it’s a matter of how many sites you will end up creating on your new network. My guess? Plenty.
Meta-tutorial: disabling 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:
- 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.
- 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.
- Delete your
/blogs.dirdirectory within the
/wp-contentfolder. This held all of your site’s uploads (but not your primary site, those are still in
- 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_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.
Hopefully this tutorial has helped you overcome the last hurdle to trying out WordPress multisite. If it has, let us know in the comments. While you’re at it, tell us what you’re using multisite for—how is it specifically useful to you?