Virtual Multiblog for WordPress

<?php echo "Hello Again, World!"; ?>

Announcement: Virtual Multiblog is now on GitHub.

Greetings and salutations.

This is my second blog, which is here to serve as a repository for the really die-hard geekery that I feel just doesn’t belong in my regular blog. When I realized the need for a second blog, installing it ended up being a longer process than i anticipated, and I thought I would share the fruits of my experience.

Let me step back for a moment. I am a true hacker at heart, in the traditional sense: I love to pull things apart and take a look. To see how they work and how they might work better. I’m also an avid Mac-head, and since the rise of OS X, I’ve been learning the ins and outs of its Unix-like underbelly.

In a nutshell, my computer is highly customized.

A few years back I got a second computer — a laptop — and quickly discovered that while keeping one computer tweaked to prime operation just the way I like it is kind of fun, trying to keep two computers in such a state, and relatively synchronized, is a frustrating exercise in futility.

I also know a good bit of web coding. As I’ve been working with WordPress for a couple years now, I’ve come across a number of good plugins and expansions along the way. Beyond issues involved with installing them, (which is admittedly pretty easy, usually) over time I have to keep up with updates to these — not to mention updates to WordPress itself. From time to time I even delve into the plugin files myself and make improvements….

And I want to put in a second blog? Am I nuts??? Thinking of what a pain it would be to maintain two copies of WordPress, I started looking into the various multi-blog solutions people have come up with. Most of them involve a lot of weird modifications to several files and basically comprise major modifications to large swaths of the WordPress code that are fundamentally incompatible with the regular version.

I am a great fan of what I consider “elegant” coding, which means that the designer does his job with the simplest and most straightforward methodology possible. And I found a very elegant solution to the “multiple blog on one install” question. Allan Mertner came up with something that blew me away with its simplicity and power.

WordPress holds all of its data in a MySQL database, and there is a single file called wp-config.php that holds the database login information. Allan looked at this and realized that if you can change that one file, you can completely replace the blog. With this key realization he came up with a cunningly straightforward multi-blog system:

  1. Replace the standard wp-config.php file with a new version that calls a different configuration set depending on what directory it’s in.
  2. Set up symbolic links that serve as “virtual directories” that all point to the WordPress directory.

Using the example of this site, I have an install of WordPress in the root web directory, and a symbolic link called “nerdaphernalia” (that’s right, you’re soaking in it!) that points back to the root. The modified wp-config file points to either the default or nerdaphernalia config file, depending on which of those two directories it thinks it’s in.

So other than a happy user, where do I come in in all this? Well, I made a number of improvements. First, Allan’s system was great, but it required us to install various files in and around the core WordPress files, which for me at least defeats part of the purpose of using a multiblog system in the first place. I’m trying to make updates easier, remember? Updating WordPress generally involves deleting everything but the wp-config.php file and the wp-content folder, and then dropping in the new versions of everything else; but if there are important but non-standard files strewn about, I can’t just do that. I have to remember to go through and preserve those files, and then replace them when they’re done. Add in a few plugins that work the same way, and we have a real hassle.

So first off, I tucked all the files, except for the one modified wp-config.php, into a folder in a safe place. Next, I greatly streamlined the install process. At a minimum, the user only need edit a single configuration file, autoconfig.php. If desired, the various blogs can each have individual config files, but it’s no longer necessary.

I’ve added user-accessible functions (and the really handy VUSER constant) that can be used in themes and plugins. I’ve added the ability to customize the location of the configuration files, so the security-conscious can move them entirely out of the Web directories if they wish. Overall, we are left with a easy but powerful system for running virtually any number of blogs off a single install of WordPress.

Install instructions are included with the download. Still have questions? Check out the readme and the FAQ. (Note: Sometimes the readme will list a higher version than the download. That happens if I have a development version installed.)


Here’s what you’re really looking for: the download link.

For the truly latest and greatest, I suggest you go get it from GitHub.

Here is a local link, which probably has an older (but possibly more stable) version:
Virtual Multiblog v2.6.2

History/ Acknowledgements

For a detailed history, please see the readme file in the download.

Many of the improvements to version 2 were based upon or inspired by commenters to my blog. To them, and to everyone who has sent comments, I am grateful.

Good luck. Have fun.

771 Responses to Virtual Multiblog for WordPress

  1. Chris says:

    Anyone tried VMB with WP 3.3 RC1?

    • Stephen R says:

      It’s running just fine on WP 3.3. Virtual Multiblog is actually quite version-stable because it’s running at such a low level. In fact, it’s so low down that you could say WordPress is running on top of VMB, not the other way around.

  2. Tim G says:

    I’m trying to get this working, but no luck so far. Would love to get an answer to the question of whether this works with WP3.x since so-called multisite has been added to the base functionality. I especially like the idea that long term you’re aiming at trying to achieve a one-signin-for-all solution.

    Are we still in development with this?

  3. Stephen R says:

    Tim G — See the previous comment. Yes it still works with current versions of WordPress. This site still runs on VMB.

    The core system is very stable, and pretty future proof. It takes a significant, low-level change to WordPress to break VMB. In fact, in the history of VMB I don’t believe I’ve EVER seen a change in WordPress that broke VMB for existing installs.

    As for future development, I’m not sure when, if ever, the single login change will happen. That almost warrants an entirely new plugin — it’s more than a minor feature, and I like VMB’s stability born of simplicity.

  4. Alvise Nicoletti says:

    It works perfectly, 2 years now and it really changed my life as a webmaster.

    The initial configuration is a little hard, and for me it didn’t work like the guide said, but this “plugin” is really revolutionary.

    The only add-on I’m expecting in the future is a plugin to handle all the blogs installed and see wich plugins they use (to discover wich plugins are NOT used, and to put as “Muste Use Plugin” a plugin.

    I would also be easier to have only one configuration file that catches all websites (like apache sites avaiable) instead of a file for each website.

    I would like to collaborate with you, write me if you want to.

  5. luison says:

    I keep having some issues with some themes and plugins specially when trying to change wp-contents or plugin locations. Likely due to bad practices of their developers.
    Other than that, as Stephen says we’ve been using it on at least the last 6/7 versions of WP with no major issues on updates.
    Except the big issue of only one login for all sites, VMB is way more versatile than WP core multisit feature.

  6. I guys !!!

    Thanks to Virtual Multiblog I have 50 WordPress websites in only 1 installation, so I needed a dynamically generated robots.txt (with the complete url of the xml file), and I did this with three steps:
    1- rename robots.txt in robots.php
    2- put inside the robots.php file this code accordingly to your suggestions:
    User-Agent: *
    Disallow: /wp-content/plugins/
    Sitemap: http:///sitemap_index.xml
    3-teach apache (in .htaccess file) to load robots.php when asked for robots.txt with this code:
    RewriteRule ^robots.txt /robots.php (still workin on this one….)

    If this was useful to you, please write me back and quote me in your posts 😉

  7. Pingback: Moving a WordPress blog to a new domain with search engine optimisation » CatFind

  8. Chris says:

    Anyone had any problems with WordPress 3.4? I’m getting redirect loops on new installs… may be nothing to do with VMB but I thought I’d ask.

  9. Pingback: Virtual Multiblog and .htaccess « Bertie Baggio's Wonderland

  10. Henry H says:

    On April 14, 2012, luison wrote:

    I keep having some issues with some themes and plugins specially when trying to change wp-contents or plugin locations. Likely due to bad practices of their developers.

    I’m wondering if it is the developers’ fault. I’ve seen problems in two plugins and traced it to the plugin_basename() function. According to the documentation:

    If your plugin file is located at /home/www/wp-content/plugins/myplugin/myplugin.php, and you call:

    $x = plugin_basename(__FILE__);

    $x will equal “myplugin/myplugin.php”.

    But adding a print statement to one of the failing plugins shows that it is returning the entire path of the file, not just the last directory and the file name. Naturally that causes problems. I’ve seen this in JW-Player-for-Wordpress and Lightbox-Plus. I assume that for most people, the plugin_basename() function returns the expected value, or these plugins would fail for everyone. I also assume that this has something to do with having set WP_PLUGIN_DIR, etc.

    I have patched the two plugins that I want to use but will have to remember to do it again every time they are updated, which is a pain. If anyone has any suggestions, I’d love to hear them.

  11. Pingback: twitter follower bot

  12. Pingback: Instagram Follower Bot

  13. Pingback: Multiple Sites With Independent Users | Click & Find Answer !

  14. Talya says:

    I have an existing installation of VMB that is working very well, but when I try to add a new VUSER, the redirect that happens when I first go to the new domain does not work properly and gets stuck in some sort of loop at

    I have recently upgraded to WordPress version 3.8 and wondered if it was because of that.

    Otherwise I can only think it is some kind of problem on the server side. Do you have any suggestions?

    Many thanks

    • Stephen R says:

      I see from a comment on another thread you’re talking about this site:

      So and are two sites in the VUSERS list? How do you have them listed in VUSERS, and how did you list the new one?

      • Talya says:

        I could not find out how to message you privately, so here is my VUSERS list:
        $vusers[] = ‘’;
        $vusers[] = ‘’;
        $vusers[] = ‘’;
        $vusers[] = ‘’;
        $vusers[] = ‘’;
        My install of WordPress is in a folder called ‘blog’ in my public_html. This is accessed from the URL ‘’ – I unfortunately broke that particular usage of wp by trying to install 2 different shop plugins at the same time, so now does not work. However all the other blogs that you can see listed in the VUSERS list still work fine! (except for ‘’ which has never worked, even before I broke ‘’, but has always been lost in some kind of redirect loop at the point of first setup – which you can see if you try to go there.)
        Thanks so much for your reply.
        At the moment, as a workaround, I have given up on creating a new separate blog just for the shop, and am trying instead to install a shop inside one of the other blogs (which is how come I broke ‘’)
        Best wishes

      • Stephen R says:

        Nothing obviously wrong with the VUSERS.

        Talya — an email contact is on the Feedback page. Have you made any blog-specific changes to your .htaccess?

    • Stephen R says:

      More general reply: I have not encountered such and issue myself. I don’t believe upgrading to WP 3.8 alone would cause it. It could be a lot of things.

      • Talya says:

        I had a look at my .htaccess and removed one of the rewrite rules that BetterWPSecurity had put in to remove trailing slashes from wp-admin. That worked and I was able to set up my new blog as usual. Thanks for the tip.

  15. Jose Luis says:

    We have updated our VMB installations to WP 3.8 without issues so far although we have not created new sites so have tested the “install.php”.

  16. Pingback: WordPress 2.7 | Apa Moon Beta

  17. ELAN42 says:

    I’m happy that this discussion is alive again …

    I still use this software … 4 years and everything is perfect,
    I use it for 130 WordPress websites in 3 main installations.

    I also managed to symlink /uploads/ folders in a separate hard drive, to optimize I/O performances, that is something like /medianame/

    I never had a way to thank you for your work ….

    • Stephen R says:

      “I never had a way to thank you for your work”

      Well, there Is a “Donate” link on the sidebar of every page on this site! 😉

      Either way, thanks for the kind words.

      • ELAN42 says:

        I just made a small donation …

        This “plugin” is very important to me,
        I would be glad to see an updated version with a dedicated page somewhere on your website, someday.

        I would also love a way to have a “table of installed plugins” of all my WordPress websites, to manage them and see if there are any “weird ones”.

        Do you know of someone that actually edited or enhanced your software ?

        I actually in this FIVE YEARS I made a few modifications for subdomains, error, and simplifications of the config file myself … to get wp_prefix and other stuff from the config_file_name

  18. Just wondered if you had resolved the problem of redirect loops? I am having a similar problem with new installs and also wondered if it was to do with WP version.

  19. I had “killer loops” in the past,
    it sometimes happens …
    … it’s creepy and brings headackes.

    Check your permalink and .htaccess: put it “read only” on the server once it’s ok for you.
    This because every installation will “destroy” .htaccess file for previous configured websites.

    I’m using VMB with “manual configuration”,
    so I have the “mb-autoconfig.php” and many “mb-config-domain_ext.php”.

    In the years I edited al ittle VMB, so for example now my “mb-config-domain_ext.php” only contains this 3 rows:
    $vuser= vuser(__FILE__);
    $table_prefix= prefix($vuser);
    define(‘DB_NAME’, $ROOT.’_’.$vuser);

    Where vuser and prefix are functions that extracts domain name from the “mb-config-domain_ext.php” filename.

    Guys, can we share VMB experiences so we can help the author to publish a new update ?

  20. Stephen R says:

    Announcement: Virtual Multiblog is now on GitHub!

Leave a Reply

Your email address will not be published.