21 Jun Everything you wanted to know about creating a network of multiple sites in 3.0
While the basic of Creating a network are in the codex, there are a few extras that it's hard to know exactly where to put them. Before you embark on this new feature to enable multisite, I figured I'd have a one-stop resource page for all the fiddly little bits you need to know.
And after I've been working with WordPress MU for so long (3 years? Already?) I can assure you that it had WAY more fiddly bits and the devs have distilled this down to as little fuss as possible.
What you need to know before you begin
I've been reading many questions and blog posts about the "new" multisite feature and wondering how it compares or not to WPMU. The functionality is basically exactly the same. There were no new features added.
If you are currently using WordPressMU and have multiple blogs/sites, you do not need to do this. You are already running a network and have multisite enabled.
Using multisite, especially if you are letting other users sign up, involves sometimes substantially more knowledge about servers that just being a customer on a shared host. If you have difficulty installing WordPress via something like Fantastico and have never done it manually, then running a network is probably not for you.
If you're new, there's a few things you need to be aware of.
- The sites are virtual. They don't exist on the server, just in the database.
- The sites are siloed content. While you do have one username and password across the site, you still need to go to each one to do things like post.
- Your webhost has to support it. By support, I don't mean answer specific questions about functions, I mean support from a technical perspective. The subdomain sites are driven by the use of wildcard subdomains. For subfolders, mod_rewrite. The mod_rewrite function is also used to serve uploaded files in either format. in other words, Windows servers are a little more trouble.
Getting the Network menu item to show
This menu is hidden by default. If you followed along the development cycle, you may have noticed it was easily visible. The decision was made to effectively hide it so users would have to seek it out and be armed with knowledge (hopefully) before they clicked any buttons willy-nilly.
Find the wp-config.php file in the root of your site, make a backup first, then open it up and add this line.
Please paste this somewhere in the middle. I like to stick it after the salts, but that's just me. It absolutely cannot go at the beginning or the end. If you look closely, there are a couple of comments within the config file telling you not to edit above or below those lines. So don't. 🙂
Save the file. Make sure it gets saved, too, as sometimes you may have a setup where the owner of the file is not you, but Apache. Get your webhost to change the owner so you can edit it, then when we're all done, change it back for security.
Installing the network part 1
Now when you login, you'll notice a new menu under Tools -> Network. Most of the options are pre-filled for you, based on your main install. This will now be the main site in your network.
You may or may not be given the choice between subdomains or subfolders. This depends on a few things.
- - subfolders are disabled if your install is more than a month old. Why? Because the subfolder setup stuffs a /blog/ in the permalinks off the main site to prevent collisions between page names and site names. In an exisiting setting, changing your permalinks on you would not be good. This will be dealt with in a future version.
- - If you are using an IP address or just localhost, you'll only have the option of subfolders. Same as if you entire install runs out of a folder. (Like mydomain.com/wp/)
- - No choice: If your site URL is different than your home URL, meaning your WP install is in a folder and the index.php is a level above, then you can't enable the network. No really, you can't. There's no .htacess tricks you can do. This setup really interferes with the individual sites lookup. Domain mapping won't fix it either. People have been trying to wrangle it for 3 or 4 years now, and it's just not possible.
I have seen some unexpected options show up depending on what part of the setup is detected first, so your mileage may vary.
If your installation is in the root of your website, that is the best place for it. You'll have the choice of either as long as your webhost supports it.
Once you've clicked the button it's on to...
Installing the Network part 2
Wow, wall of text.
There's two textboxes here. The first one deals with more defines for your wp-config.php file. Copy them , and paste them right in your wp-config.php file you edited earlier. I like to put these lines right after the define multisite line we did earlier. This is just to keep them all together.
The next textbox has htaccess rules. The .htaccess file is a hidden file in the root of your site. Make sure whatever you're using to look at the file system has "show hidden file" enabled. After making a backed up this file, replace whatever you have in the htaccess file with the new rules. These control how the blogs and extra files are served.
You also need to create a new folder under wp-content called blogs.dir. This folder is where site uploads will be stored. Just media uploads, not posts. 🙂 They are held in folders with the blog/siteID number in front of them, and then rewritten via the htaccess file to hide that part to the viewer.
Once you've saved both file on the server, log out of the WordPress admin area.
When you log back in, you'll see a new menu box called Super Admin. This area is for global management of your new network of sites. You may now add new sites at will. They show up instantly.
Help! I picked the wrong format!
In case you picked subfolders or subdomains, found out it wasn't working for some reason or realized it was the wrong choice, you CAN change this without reinstalling. It's a little tricky and comes with caveats.
Caveat #1 - you have to sacrifice any sites you already made
Caveat #2 - if you're forcing the subfolder install, it WILL stuff the /blog/ permalink in there and you'll need a plugin to remove. And I haven't tested this.
Open up your wp-config.php file and find this line:
define( 'SUBDOMAIN_INSTALL', true );
It will be either true or false. True means you're using subdomains, false means subfolders. Change it to the one you want. Keep the previous caveats in mind.
Don't forget to subscribe to my feed so I can show you how to use it. 😉
Plugins that have instructions to go in the mu-plugins folder are still relevant. Just create the folder under /wp-content/ and use away! 🙂
You can also get this tutorials expanded with screenshots in a free ebook here: Enable Multisite ebook.