How to enable Multisite on your WordPress 3.0+ installation

52 Comments

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 wp-config.php file

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:

define('WP_ALLOW_MULTISITE', true);

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.

This is what my filled out network screen looked like before clicking install. Note that I'm setting up multisite locally here, which is the cause for the different network URL.

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 wp-config.php and .htaccess files

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.

You should be following the instructions from a screen that looks like the above screenshot. Everyone's settings will be slightly different, though, so be sure to copy directly from your WordPress installation.

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:

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.


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?

52 thoughts on “How to enable Multisite on your WordPress 3.0+ installation

  1. Pingback: Understanding WordPress Multisite, a conceptual introduction | WPCandy

  2. Excelent tutorial, now i know how to setup and use a multisite WordPress Installation… Thanks for the post!

  3. Nice! Very clean and simple…

    Question though… I’ve read (wpmututorials.com) that you can’t enable Multisite in subfolders unless it’s a WP install less than a month old. Is this still the case? I think Andrea said because it puts /blog/ in existing permalinks.

    The problem would be for someone that doesn’t have Wildcard subdomains enabled by their host, and have had WP installed for a long time, they are out of luck, right? This is why I have not attempted it.

    • Hmm, I don’t specifically know the answer to that question. I pretty much always do subdomains, except for my local multisite installation.

      It’s a good question though. Maybe if Andrea stops by this post she can help us out 🙂

    • Yes, it’s still the case but there’s a workaround if you don’t mind getting your hands dirty. 😉

      Go through the steps, enable subdomains (which you know won’t work).

      Go edit config again, and change subdomains=true to false.
      Go get the subfolder htaccess rules under the Network menu item.

      tada! make a site. should be a subfolder one.

  4. Pingback: Multisite isn’t simple enough for users. And it shouldn’t be. | WPCandy

  5. Pingback: How to map domains to sites within WordPress multisite | WPCandy

  6. Pingback: Activating Wordpress Multisite Mode | Smashing Blog

  7. I have been working with WordPress for 2+ years and it is the best! I have done about 2 dozen sites but all as single installs. I’m considering a project that will require me to make 50+ sites in the next year for a company’s staff. Multisite seems like a logical choice… but I’m still gun-shy.

    I have read everything I can in the last few days about Multisite and, other than some more involved set-up and making sure your host can handle it, I can see a single negative. Has anyone found a downside to going this way? I hate to be looking for some cons to balance the pros but I’m surprised I haven’t see any yet. Even little ones? 🙂

    • Well, there’s a few people have to consider:

      – sites are separate but the userbase is not.
      – occasionally a plugin just doesn’t want to work right.
      – you have to know what you’re doing when something goes wrong 😉

      I’d suggest just getting a local copy set up somewhere, or a spare domain, and start trying to break things.

  8. Hi, thanks for the great tutorial. I just finished setting up multisite, and, unfortunately, it isn’t working properly. I created a test site and there are a few errors:
    -no site files have been created in the folder
    -the name of the site seems to be messed up and the link to visit it has errors in it, it’s missing backslashes.

    This is my fourth time trying to setup multisite with no success and I don’t know what to do to fix this issue.
    Has anyone experienced problems similar to this?

    Thanks!

      • Thanks so much Andrea! You are the best! Worked perfectly and I am currently setting up sites! I’ll definitely keep coming back here for more tips, advice, and help. 🙂

      • Hi, I did have one more question, if you don’t mind.
        I created my first user and site, when I log in to that site’s backend, the super
        admin menu shows up, is there anyway to remove access to that for all of the sites i create?
        It’s also possible I am just misunderstanding how it works completely, are there any good tutorials for managing users and sites?
        Thanks again for all of your help,
        -Roman

  9. Great Great is perfect for my new site, I have installed now on a subfoler two independent instalations, but visitors must ask to differents databases, Thank you very much!!
    Lorena

  10. I am struggling between using BuddyPress or WordPressMS to set up the following concept:

    Each user once registered will be able to post on their own “mini website” based corresponding to a unique directory. Is there a way for that to be automated such that a user “subscribes” on the “main site” in order to be grated access to setting up their own “mini-site” from the “hosting main site”. I have a client that wants to set up an fully automated method of creating “private” websites for people who want to create a “Memorial Website” for their loved ones. ( Almost like a Private Forum or Private Group in Buddy Press) I did the research and there are some very large sites out there that do this sort of thing but they are almost all hard coded with multiple SQL databases. One developer told me 6 months of coding and cost to client $30,000 ( yes you saw that right! ) Why this guy wants to compete with these large mega sites is questionable but regardless he is the customer and I thought I would try a WP solution to keep the costs down for him.

    Buddy Press lets one set up private groups,,, But I haven’t figured out if there is way yet to auto create ONE group per Registered Paid For Subscriber…. I figure perhaps WPMU might be an alternative solution… Any ideas??

  11. Is there a way to set up a network of sites locally through MAMP? I get an error message “Error: You cannot install a network of sites with your server address. You cannot use port numbers such as :8888”

    • @Andrea, this happens because MAMP’s web server runs on port 8888 by default, whereas WP expects the more usual port 80. To change MAMP, go to MAMP preferences and change the Apache port to 80. (Note that this may cause other things to break, depending on how your existing sites are set up…)

  12. Wow this was just what I was looking for! Now I just have to work on my themes 🙂 Thank you soo much for this walkthrough.

  13. Thanks for this tutorial – made it very easy, although I couldn’t see the Super User admin area at first, finally saw the Network Admin link in the top right – and all was revealed!

  14. Hello there,

    i have a little problem with wordpress MU. I have set up an enviroment with two blogs.
    The mainblog (superuser) runs perfectly no struggle, great. The second blog seems to have a problem with the upload folder. If i upload images to posts, i cant see them, either in the dashboard upload nore in the “rendered” browser view. I think it could be a problem with the blogs.dir folder or maby something with the .htaccess data.

    Here i post the content of the .htaccess data: Perhaps it helps:

    Thank you guys, i hope you allready have a clue whats going on.
    Cheers Marcos, great articles by the way. Really like the clean style of the blog.

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]

    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule . index.php [L]

  15. Hi. I was reading some WPMU articles (for example: http://wpcandy.com/teaches/how-to-enable-multisite). I had a few questions:
    -If I already have a WP site, can I just turn that into WPMU? Is my ONLY issue the “over 1 month old” thing?
    -If I have site1.tourkick.com and site2.tourkick.com and site3.tourkick.com, can I still have tourkick.com as the main site, with no traces to site1, site2, or site3?
    -Can each site have different plugins, themes, etc?
    -Currently, I have a single Page (not Post) for each property video we do. I chose Page because I wanted to have a child Page (e.g. http://tourkick.com/tours/20101207-6303-south-28th-west-avenue-tulsa-ok-74132-1388/ and http://tourkick.com/tours/20101207-6303-south-28th-west-avenue-tulsa-ok-74132-1388/unbranded/ — 2 different links, one needed to comply with the local MLS). If I wanted the first link to be http://www.6303s28thWestAve.com, I know I could just use DNS to redirect that domain to that Page’s URL. But if I wanted to setup a property-specific blog just for that one property listing, I would need WPMU installed, right? And then I’d want WPMU domain mapping instead of just a DNS redirect, right?

    Thanks.

    • – it;s not WPMU anymore. 😉 That was a separate program.

      – yep, you can create a network on an existing site. The 30 day thing is just a check to prevent you from using the subfolder setup, which would break your permalinks becasue it adds a /blog/ to links on the main site.

      – the sites are independent, so if there’s no link on your main domain to the other sites, user have no idea how to get there or even what they are.

      – yes, if you wanted a section on a new domain, you’d use multisite and set up a network (it’s not WPMU remember?) and then use the domain mapping plugin.

      • Can each site have a different set of active plugins and can each site choose to have different themes?

        Why does /blog/ get added? What’s the reasoning behind that? Could you change it to /something-else/ instead of /blog/ ?

        How can you tell if a plugin works with WP multisite (WPMS?) without the plugin author specifically mentioning it in their description or installation instructions?

        Thank you.

        • yes, each site can activate different plugins and themes.

          The /blog/ only gets added to the main blog to prevent URL collisions in a subfolder install. It does not happen in a subdomain setup. No, you cannot change this. (yet).

          If a plugin doesn’t mention multisite, just activate in a single site in the network and see if ti works. Don’t network activate it.

          you may want to get the book mentioned here,
          http://wpcandy.com/reports/wordpress-all-in-one-for-dummies-now-available-on-amazon
          as I cover all the multisite basics in 6 jam packed chapters.

  16. OK. so much written yet nobody gives example of the two most common uses: How to use it??? in :
    1) language selector with custom htm a tags.
    2) and this is my theme (not dynamic content)
    I will appreciate it if you give me a hint, my fingers starting hurting from googling and finding the same info which doest help attall how do you use the multi side feature properly>???

    • – add localization files and pick your languages from your user profile. just like single wp.

      – for themes, activate the theme. just like single wp.

  17. Great tutorial!

    I wonder though with doing this does this give us the ability to give it a subdomain such as

    example.site1.com

    I think It would be great if you can use this for running different sites using different urls.

    • thats the idea. however you use single template for all!
      and nobody say how to make a simple language switcher or one
      the ‘right’ way to do it is _e() … getext() adn internationalization
      but thats not what i want either 🙁
      so far WP multisite is FAIL! get_current_site()->id , always returns 1!

  18. Just remember:
    In 3.1 you have an entire sub-section for Network Admin. The link can be found on the upper-right of all admin screens, by your name.

    The Guide needs an update on this

  19. Your tutorial is great, Ryan, thank you.
    I have a comment that I hope will help other people who encounter the same problem I had trying to set up a new WordPress Multisite install.
    I’m using bluehost as my hosting service, which allows for wildcard redirects, and has the Apache mod_rewrite enabled by default. So, setting subdomains after setting up a “*” wildcard redirect seemed like a no-brainer for me.
    I went through the wp multisite setup process (multiple times, hence my reading of Ryan Imel’s great tutorial over and over and over…). After setting up multisite I created a new site and clicked on ‘dashboard’ or ‘view’ links from the super admin ‘sites’ menu. I kept getting a nasty “internal server 500 error” or a 404 error.
    My, oh, my, was I frustrated. I called bluehost support numerous times (no help), and I couldn’t figure out why, when everything seemed to be setup properly, I couldn’t enjoy the glory of being able to setup multiple sites.
    Well, here’s the solution:
    Bluehost, which uses cPanel, automatically inserts a folder called “wildcard” into the document root directory for which a wildcard subdomain is created. A user has to be aware to catch the automatic creation of the “wildcard” folder and delete it from the “create a subdomain” options within the cPanel -> doman -> subdomains menu before saving.
    Ryan, thanks again for your tutorial.

    • hi Palmer,
      im using bluehost as well as my hosting.
      but still i can’t get my multisite installation done.
      finished with my wordpress stuff, but when i try to resolve subdomain (such as: samsung.matkomplen.com) i still got the error.
      could you give me more detailed instruction to get it done?
      thanks in advance of your help.

  20. Thank you Ryan for this tutorial, it really opened my eyes 🙂

    One question for you: I’d like to add content in other languages on my site, say English. Could Multisite be the way? I’m thinking about adding a subdomain, en.selecto.ro, and then adding English content there. What do you think?

    • Hmm, I’m not sure whether that’s the most elegant way to add other languages or not. I don’t have much experience with WPML, but I think you should check it out for multilingual stuff.

  21. I did the step above for installation at my local computer (XAMPP 1.7.7 and WordPress 3.1.2) . After re-login, I still cannot find the “Super Admin Menu”

Comments are closed.