Virtual Multiblog for WordPress

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

Note: If upgrading to VMB 2.5 from a previous version, please read the upgrade instructions.

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.)

User “JZ” is selling written instructions for installing the system. (Please Note: I have not even seen his instructions, I’m just letting you all know.) More info in this comment.

…And if the directions are worth money to you, perhaps the actual software is worth something as well?

Download

Here’s what you’re really looking for: the download link. Have at it!

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.

684 Comments

Pages: « 118 19 20 21 22 [23] 24 25 26 27 2835 » Show All

  1. #441 | Posted February 15, 2009 at 11:39 pm

    Hi!

    Great addon for wordpress!

    I want to take some of my wordpress sites and stack them together into one wp-core. What is the best way to do this? Is it possible to leave the databases the way they are without any change to them? (and make separate config-files for the sites)

    Mads

  2. #442 | Posted February 16, 2009 at 1:25 am

    Can they be on same the server.

  3. #443 | Posted February 16, 2009 at 11:22 am

    Mads — This system should work for that. Use different config files for each blog and you can set the pre-existing DB information in those files, and use that data.

    Knobman — The files *must* be on the same server, by definition. I believe the MySQL database(s) can be on different servers, per standard WordPress.

  4. Alex Oliveira
    #444 | Posted February 28, 2009 at 1:28 am

    Hello, I’m looking to hire someone to deploy this on my WP site. I’ll pay top dollar for top dollar work. If you’re interested please contact me at [email removed - ed.]

  5. #445 | Posted February 28, 2009 at 3:08 pm

    Hi Stephen–

    Problem solved! The issue was .htaccess and I needed to have:

    RewriteCond %{REQUEST_URI} (/summer2009|/scope2009|/oakwood2008|/)?/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . %1/index.php [L]

    Why it was working before I can’t explain, but this certainly solved my issues!! Thanks for a GREAT product!

    Stephen

  6. #446 | Posted March 1, 2009 at 7:01 pm

    I have found that if I remove the RewriteBase and then slightly tweak the RewriteRule then I can have blogs setup like this below and get the nice permalinks.

    /blogs <– Main blog here to start and then it must be removed or a recursive situation happens.
    /blogs/blog1
    /blogs/blog2
    /blogs/blog3

    # BEGIN WordPress

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . index.php [L]

    # END WordPress

    You must be careful though when making admin changes in wp because it will overwrite your changes to the .htaccess file.

  7. #447 | Posted March 2, 2009 at 10:29 am

    (Other) Stephen –

    I believe you should remove the penultimate slash (and pipe) in the first RewriteCond, e.g.:

    RewriteCond %{REQUEST_URI} (/summer2009|/scope2009|/oakwood2008)?/

    Otherwise it’s looking for a double-slash, which is probably not needed.

    Beyond that, glad you got it working.

  8. #448 | Posted March 2, 2009 at 10:36 am

    Asylum — I’m confused as to what you mean by “Main blog here to start and then it must be removed”.

    Also, what is your folder/symlink structure in that example? Do you have symlinks pointing to their own parent folder?

  9. fretbuzz
    #449 | Posted March 4, 2009 at 3:35 am

    Is there a way to create multiblogs but NOT having each blog managed as a complete separate install — separate admin sections, separate users, etc

  10. #450 | Posted March 4, 2009 at 9:48 pm

    Sure. It’s called WordPress MU.

  11. Userx
    #451 | Posted March 7, 2009 at 8:00 pm

    Great plugin, but does it work with 2.7x auto-update feature? I mean updating WordPress itself, not plugins. Will I have to run the auto-update manually on every blog?

  12. #452 | Posted March 10, 2009 at 7:08 pm

    [...] We talked about his favourite things and googled for clipart that represented those things. He directed me on where to place the images, and his very own custom header was born. He picked a name, and I set up the blog for him. It was relatively simple since I have already set up a multi-blog using wordpress. [...]

  13. #453 | Posted March 11, 2009 at 1:53 pm

    I have been toying with virtual multiblog for a little bit now and so far I think it is great. There is room for some more to be added in the future but it works and it works well. I have run into a snag though and I am not sure how to remedy the issue. I will explain what I have that is working and then what I am trying to do from there.

    I have set up the single install of wordpress. I then have created symlinks to the locations of each blog. The majority of them are sub directories and one of them is a separate domain altogether and it is in a sub directory of that domain. I did this by using the mb-autoconfig.php and then creating a single config file for the one separate domain because it uses a different database than the others. That all works great. Now comes the problem I am having.

    I have 2 sub domain blogs also that I would like to have use this same install as the others do. I try to create the config file for the sub domains as I did the separate domain I previously mentioned and it doesn’t work at all. The file structure is below.

    /websites/web1/web/blogs/blog1 <- domain1.tld/blogs/blog1 <- Works
    /websites/web1/web/blogs/blog2 <- domain1.tld/blogs/blog2 <- Works
    /websites/web2/web/blog <- domain2.tld/blog <- Works
    /websites/web3/web <- bobs-blog.domain.tld/ <- Doesn’t work
    /websites/web4/web <- fred-blog.domain.tld/ <- Doesn’t work

    I get a 403 when trying to access the sub domain blogs. They are both symlinks having web as the target and checking file permissions on them they are 0777. Can’t give any more permission than that. I have also tried using the mb-users file according to documentation in hopes that would help but to no avail.

    Any ideas as to what I am doing wrong or is what I am trying not possible?

  14. #454 | Posted March 11, 2009 at 1:57 pm

    Sorry the information for the paths are wrong in that previous comment. Here are the proper paths. Notice the 2 sub domains are subs of the first domain but have their own directory as apposed to being sub directories of the main domain.

    /websites/web1/web/blogs/blog1 <- domain1.tld/blogs/blog1 <- Works
    /websites/web1/web/blogs/blog2 <- domain1.tld/blogs/blog2 <- Works
    /websites/web2/web/blog <- domain2.tld/blog <- Works
    /websites/web3/web <- bobs-blog.domain1.tld/ <- Doesn’t work
    /websites/web4/web <- fred-blog.domain1.tld/ <- Doesn’t work

  15. #455 | Posted March 11, 2009 at 2:08 pm

    Also in regard to this.

    Asylum — I’m confused as to what you mean by “Main blog here to start and then it must be removed”.
    Also, what is your folder/symlink structure in that example? Do you have symlinks pointing to their own parent folder?

    The way I set up the symlinks is shown below where the first blog I created I consider the main blog. All the rest of the symlinks where created inside that one like this.

    ln -s /websites/wordpress /websites/web1/web/blogs
    ln -s /websites/wordpress /websites/web1/web/blogs/blog2
    ln -s /websites/wordpress /websites/web1/web/blogs/blog3

    Didn’t work out like that without having to remove the first symlink. That .htaccess I had shown in that comment still works though for the way I am doing it now described in my last 2 comments.

  16. #456 | Posted March 11, 2009 at 3:03 pm

    Ok so I have found the answer. Not even sure what gave me the idea to look here under “Q: Okay, I’ve made a folder for a second blog. Now what do I put in it?” But the answer is there even though though the question is not really related.

    Just point the website to the wordpress location in your servers conf file for the sub domain and it works great.

  17. #457 | Posted March 15, 2009 at 12:34 pm

    I’m using Word Press predominately as a content management system. I’m wanting to have two troop web sites. A public site and a members only site using the members only plug-in and having the members only site be an ssh site. What I would have is a WP multi-web site with some posts in each site but mostly pages. Is this possible with Multi-blog?

    Does v2.5 have the means to configure the public site to show new posts from the members only site? (great but not essential).

    Thank you.

  18. #458 | Posted March 15, 2009 at 10:49 pm

    VMB effectively gives you two separate installs — it just saved you from maintaining two sets of files.

    Thus, no — it doesn’t have the means to cross-post between blogs. But if you can find another plugin or somesuch that *does* do this, it will likely work in conjunction with your VMB installs.

  19. pc
    #459 | Posted March 19, 2009 at 10:30 am

    Hi,

    Great enhancement to WP and just what I needed. I have what is probably a dumb question…

    I’ve been developing my WP site with the IP of the server set as the WordPress URL. I now want to change this to domain name that the site will be run from. Whenever I change this in the WP settings I get pointed to the ‘Install new blog’ page and have to change it back in the db to get the site working again.

    I’m obviously missing something. My DNS and VHOST is (AFAIK) set up OK…but I suspect the error may be there.

    Is there anything I need to do specifically for multiblog?

    Thx.

    -pc.

  20. Steve Lionbird
    #460 | Posted March 28, 2009 at 10:31 pm

    Hi Stephen,

    I’ve been searching for a solution and believe I’ve almost found it with Virtual Multiblog but I’m looking for your advice on a best solution.

    Here’s what I need to do:

    Set up one WordPress installation for multiple blogs (/root/blog/) based off of the subdomain (e.g. code.example.com/blog) – but at the same time, be able to access these multiple blogs with one “master” user account, instead of having to set up users anew for each blog.

    Is there either a way of using Virtual Multiblog in conjunction with WordPress MU, or maybe an add-on that forces the use of a “master” users table for all potentially existing blogs – instead of creating a new one for each WordPress instance?

    I hope I’ve explained what I’m trying to do well enough.. it has been a very long week for me though so let me know if I’m not making sense.

    Many thanks in advance and good job on the hack.

    Best,
    Steve

Pages: « 118 19 20 21 22 [23] 24 25 26 27 2835 » Show All

Post a Comment

Your email is never shared.

Subscribe without commenting