<?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:
- Replace the standard wp-config.php file with a new version that calls a different configuration set depending on what directory it’s in.
- 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!
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: « 1 … 24 25 26 27 28 [29] 30 31 32 33 34 … 35 » Show All
Hi Stephen, Thanks a lot for your feedback. It’s clear now that the database structure remains same and per blog separate tables will be created. What is with images and uploaded files to the media libraray? Are these all stored in the same folder and if so how can you separate them in case you would like to move a single blog? Philip
[...] Virtual Multiblog for WordPress [...]
[...] to have been addressed – in WordPress at least – by multiblog adaptations like WPMU , WP Hive , Virtual Multiblog and Multiply . The idea is to have one interface, and one administrator account, but multiple [...]
[...] to have been addressed – in WordPress at least – by multiblog adaptations like WPMU , WP Hive , Virtual Multiblog and Multiply . The idea is to have one interface, and one administrator account, but multiple [...]
I’ve been trying to install Virtual Multiblog to my site. I think the concept for it is great and it will probably be super easy to handle once it is installed, since I only would need to update one installation.
I don’t think initial installation is all that easy though. Maybe I’m reading into it too much, I dunno. It took me a bit of work to figure out the Symlinks, but I got that part.
I went line by line through your instructions on the rest of the install. I’ve done manual database installs before, so I’m not worried about that part.
When I drop wp-config into my wordpress folder, that’s when problems start popping up. I get the following error:
Warning: require_once(/home/ssd01001/public_html/main/wp-content/multiblog/resources/vmb-init.php) [function.require-once]: failed to open stream: No such file or directory in /home/ssd01001/public_html/main/wp-config.php on line 63
I’m CHMOD to 777 to make sure that wasn’t the issue.
$vusers[] = ‘main’;
$vusers[] = ‘art’;
$vusers[] = ‘writing’;
$vusers[] = ‘photos’;
$mydomain = ‘ssdworks.com’;
I’m also using the vuser config
mb-config-vuser_ssdworks_com.php <with vuser being the appropriate above title . . .
I've removed the // before the $table_prefix = 'vuser'; and set table prefix to match the vuser name
Any help would be much appreciated. I'm just not sure where I'm going wrong. I'm thinking the issue involves wp-config.php in my wordpress installation directory, but that's only a guess.
Thanks!
Sam
Interesting,
I am still in a trial and error cycle. I am thinking the problem is Plesk which I manage my VPS with.
Has anyone gotten a domain1.com, domain2.com version working on Plesk?
If so what was the procedure you followed?
Thanks for writing about it
@Philip:
You could try this WP plugin. It was crafted for website migration, upgrading, changing URL paths in the database etc.
Just make a backup first.
http://urbangiraffe.com/plugins/search-regex/
I use this WP pluging for backups :
http://www.ilfilosofo.com/blog/wp-db-backup/
@software developers
I have set up many different domain variations on a Plesk VPS using a single code base/document root.
The key is using vhost.conf files.
Drop a vhost.conf file into the conf folder of domain2.com that reset the DocumentRoot to that of domain1.com
I am on CentOS so via SFTP I created a vhost.conf that looks like this;
DocumentRoot /var/www/vhosts/domain1.com/httpdocs
# do you really need all options?
Options Indexes ExecCGI FollowSymLinks MultiViews
AddHandler cgi-script .cgi
# are you using .htaccess files? if not, set it from all to none
AllowOverride all
Order allow,deny
Allow from all
php_admin_flag engine on
php_admin_flag safe_mode on
php_value open_basedir “/var/www/vhosts/domain1.com/httpdocs:.:/php:/tmp”
php_admin_flag engine on
php_admin_flag safe_mode on
php_value open_basedir “/var/www/vhosts/domain1.com/httpdocs:.:/php:/tmp”
That was placed in the conf file of domain2.com /var/www/vhosts/domain2.com/conf
Reboot the VPS because there is now a vhost.conf file in the conf folder of domain2.com Plesk will update the httpd.include file and you should be good to go.
NOTE:
My example vhost.conf file may or may not work with your server configuration particularly the php_value open_basedir portion it will depend but the overall use of vhost.conf is what you need to do to get this working properly on Plesk. DO NOT edit your http.indclude file to achieve this Plese rewrite those on reboot so your changes will be overwritten. I learned that the hard way
I would like to create a css file for some blogs, but not all. I wrote the following code to look for the css file and use it if it exits
$clean_vuser = get_virtual_user( true );
if (file_exists(get_template_directory() . “/styles/” . $clean_vuser . “-style.css”)) {
$stylesheet = get_stylesheet_directory_uri() . “/styles/” . $clean_vuser . “-style.css”;
}
else {
$stylesheet = get_stylesheet_uri();
}
Then used “echo $stylesheet;” in the right place.
Now I would like only the users of that blog to be able to edit the stylesheet of their domain, but not others and not the default one. Anyone know how to do this?
Michael — I suppose you could put each CSS file in a separate *folder* and give each user FTP access to just that folder.
If you’re looking for a web interface within WordPress, that’s WAY beyond the scope of VMB — you’re talking an entirely different plugin. (Though you may have some luck finding an existing plugin and modifying it….)
Hi Michael,
I saw your post the other day, but didn’t have the time to respond and forgot about it.
It’s like that again, but it’s better to tell you now instead of it slipping again.
What you want is also a dilemma with regular (non-virtual-multiblog) WP blogs.
It’s making the decision between hacking the theme files directly, or creating a child theme and hacking that.
Adding multi blog only multiplies your dilemma, but it is still the same one.
Raena Jackson Armitage of Sitepoint, has a very good introductory tutorial on how to do this in the cleanest possible way over at her blog at Sitepoint.
http://www.sitepoint.com/blogs/2009/05/05/build-your-ow...
Good luck with it.
[...] Virtual Multiblog for WordPress – Nerdaphernalia striderweb.com/nerdaphernalia/features/virtual-multiblog – view page – cached #Nerdaphernalia » Virtual Multiblog for WordPress Comments Feed Nerdaphernalia Features Nerdaphernalia latest posts Nerdaphernalia latest — From the page [...]
[...] Plugin: Subscribe to CommentsJavaScript Function: dupeNode()OS X App: HTML ImageTaggerVirtual Multiblog for WordPressFAQ — Virtual MultiblogWordPress Plugin: Comment SpotlightWordPress Plugin: Log Deprecated [...]
Hi guys.
I’m subscribed to this “thread” because I love this plugin, and it’s one year now that I’m using it and I found it SO helpful because I have more than 40 wp-websites into two different installations.
I want to share with you this code that takes the mb-config’s filename to “generate” the wp_prefix.
If you use this, the wp_prefix will have to be:
domain_ext_
That allows to have the mb-config files all equal saving precious time:
Hi Steven,
you know how exalted I’ve been about VMB, but I seem to have found one principal issue:
How do you deal with sitemap.xml files for all the different blogs? When all blogs share the same folders, they inevitably share the same sitemap.xml file.
Any suggestions?
You might want to see this comment.
I’ve followed the installation instructions step-by-step (v2.6.1), and setup separate wp-content directories for each blog.
Many of the plugins are not working.
They keep trying to read/write/include stuff at the <vmb-base-install-directory>/wp-content rather than at <individual-blog-docroot>/wp-content
The value of ABSPATH constant available to the plugins is always <base-install-directory>.
Is this intentional (as in plugins are not supposed to rely on ABSPATH) ?
Steven, thanks for the advice.
In particular, the casual “no htaccess mods” at the end gave me the hint that, if all else fails, a rewrite rule can be setup to map “prescribed.file” onto “domain-prescribed.file”. While I’m glad to get away w/o rewrite rules in the case of “sitemap.xml”, it’s good to know there is a “plan B” for other cases.
Thanks again for the great work.
Hola, loving the plugin thanks a lot. I’m using 2.5 atm. Regards upgrading to 2.6.1, is it as simple as just dropping the new files into the appropriate directory?
datakid — Yes, that works. Just be sure you don’t delete or overwrite your config files.
Pages: « 1 … 24 25 26 27 28 [29] 30 31 32 33 34 … 35 » Show All