NOTE: This system has a new page — you can find it at http://striderweb.com/nerdaphernalia/features/virtual-multiblog/. I’ll leave this page up for historical purposes, but it’s closed to new comments. Comments are most assuredly open on the new page.
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. I discuss the reasons in a bit more detail over there, if you haven’t seen it.
I’ve been thinking about this for a few months, and have taken a couple weeks to get things going. The reason setting up this second blog has taken so long, and the reason my main blog has been virtually silent for so long, is that in the process, I did something kind of cool.
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. Allen 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 my /blog/ directory, and a symbolic link called “nerdaphernalia” (that’s right, you’re soaking in it!) that points to /blog/. The modified wp-config file points to either the blog 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 set it up so that the only files that need to be modified by the user are the wp-config.php itself (with settings relating to the blog directories) and the individual wp-config-blogname files for each blog. I streamlined the wp-config file quite a bit, leaving a bare minumum of code in the file that people have to tinker with, and dumping most of it into a file that nobody should have to modify. Toss in some minor fixes, and we are left with a easy but powerful system for running virtually any number of blogs off a single install of Wordpress.
I’ve blathered on long enough. Here is the download, including all the files you need (except Wordpress itself), and a full set of instructions.
Please Note:
I’ve spent a lot of time working on this system, making it as solid and easy-to-use as possible. If you would like to contribute something to support this site, it is appreciated.
Good luck, enjoy, and I hope people find it useful.
116 Comments
Pages: « 1 … 2 3 [4] 5 6 » Show All
Stephen -
First of all thanks for the code, and thanks for being the world’s multiple wordpress blogs tech support.
I implemented your method, combining your instructions with those on Allen Guerra’s site, and the result is a very strange situation in which the VIRTUAL blog seems to work fine, but the ACTUAL blog returns “there doesn’t seem to be a config file” etc. Obviously there is a config file that works well enough to power the virtual blog, so I guess there is a missing pointer or wrong path somewhere for the default blog - but I’ve checked the files against the instructions and fiddled with things a dozen times and I don’t see a problem. Do you have any insight as to where the issue might be to give this result?
Before doing the multiple install, I had enabled the option of separating the (at that time only) blog directory from the blog homepage, so that even though the blog was in its own directory it could be seen from the standalone domain. I subsequently undid this (I think) because since it deals with paths I thought it might be related to the problem. Is this a suspect?
Obviously I am no programmer and am not familiar with PHP. Any advice you can give would be appreciated.
All right, never mind, I found it myself on the thirteenth try, a ridiculous misreading of one of the instructions and easily remedied. Thanks again for the code.
I have been looking for a way to provide our school faculty with multiple blogs in a single WordPress database - and I like what I see here. I am curious as to whether or not with this method of multiple blogs the WordPress search will search all the blogs in a single database or can it be limited to one blog? I would like to think there was a way to select either method. I will confess I am fairly new to WordPress (3-4 months) but can already see its considerable power and flexibility.
Loren — Search is limited to the particular blog you are in. This method truly runs separate blogs.
I am actually in the process of trying to figure out a way to search across multiple blogs, but for the moment each blog is a separate entity.
I am on the cusp of a method of making multiple blogs share User tables.
Then come cross-blog lists of Pages. Search is my next target after that.
For a work-around on multi-blog Search you can create a custom Google search-bar that works for your overall domain (or, I think, a custom set of domains). It’s not WP’s Search bar, it’s Google’s retooled for your site.
Good luck everyone who is using this method & please keep posting the comments, hints and experiences.
Thanks again Stephen. This really is the ground-breaking easy technique for multi-blogging — all those cross-blog features you talked about are side-candy. The big hurdle is already cleared with this method.
[...] thing possible? Well, after looking through the documentation at codex.wordpress.org, I found the Allan Mertner/Stephen Rider symlink hack. I plan to try to get this running in the next day or two. However, I’ve had enough [...]
Can this work with different domains like domain1.com domain2.com?
The domains files are in /somepaths/domain1 /somepaths/domain2.
The files belong to the same user on the server.
it won’t work for multiple domains currently, but I suppose it could be done. Actually, that’s really not a bad idea.
I’ll see if I can get that working.
[...] echo “Hello Again, World!”; by Stephen Rider [...]
Stephen,
Your method looks very interesting, and I think will work very well for me. But when I tried to download the zip file your server reported the file wasn’t there.
Randy — sorry ’bout that. My site is undergoing a major overhaul, and some things aren’t working. The link is fixed now.
[...] been trying to install multiple wordpress blogs on a single installation for some time [...]
Hi Steve,
Level: I set up a Wordpress blog and felt like a master of the universe. What does php mean?
OK, I thought I’d set up a neighborhood blog. It sounds like fun. Then, my wife says we should set up a different blog for a different neighborhood. Then my friend said he wants to join the club. The blogs would have the same theme, but with unique headers, posts, categories, pages etc…
Am I at the right place? My friend will want to manage his own neighborhood (most likely just the posts) on the blog that I would have set up, but I’m not sure it works like that. Can he do that with your method? So, I thought I’d ask for your guidance.
There is one other very, very fundamental question I have. I’m imagining that each blog has it’s own administration tools, but I’ve got the feeling that…well, that it is just my imagination.
Thanks in advance,
Paul
Paul — With this method it is exactly as though you have multiple separate installs of WordPress, except that you only have one set of files to maintain/update.
So… Separate admin, separate users, separate posts, separate everything.
As for the “use the same theme except different headers” question… there have been a few inquiries about that. any solution at this point will involve tinkering with PHP, and respectfully that goes way beyond what I’m willing to help out with (not being the most skilled PHPer myself…). For the time being, you might check out this thread on the WordPress site, especially my response there (I’m strider72).
If that’s too much for you, do note of course that each blog will show the different _blog name_ and tagline, per the settings of each blog, so maybe you can do something with that without going “under the hood”.
Stephen,
Thans for the help. For the record, I find all your comments to be extremely ‘newbie’ friendly. You have the gift.
Paul
[...] started looking around for ways to make WordPress do multiple blogs with 1 installation. I found this site that has pretty straightforward instructions on making /blog, /section1, /section2, /section3 all [...]
Stephen - thanks for sharing what seems like an excellent solution to the “i want more blogs” problem. You’ve explained it well enough that even a simple guitar player can understand it (i think…).
I do have one question, though. I already have a Wordpress blog; what I want to do is copy that blog to a “Laboratory” folder on my server so that I can experiment with different layouts, functionality, etc. without scaring my readers, and then import the successful changes back to my main blog.
Can I use your method to do this? Thanks for all the help! ~ Mike
Mike — That should work inasmuch as experimenting with themes and plugins goes. One blog will run the active theme and the other will run the experimental. When the experimental theme/plugin is ready for prime time, you just activate it in the “real” blog.
If you’re talking about transferring _data_ across the two, you’ll need some program for mucking about with MySQL. Your host might provide you with something like phpAdmin for that.
Hello,
I try to make a subdomain with your solution. I have a domain esourcing.be where I have my default blog.
I want to add a blog on aiandmusic.esourcing.be.
Must I finally change PHP_SELF to SERVER_NAME in the file called mb-functions.php?
All the process works, but I can’t have my blog on the subdomain aiandmusic.esourcing.be it works only on http://www.esourcing.be/aiandmusic
And in wordpress, must I change the wordpress address and the blog address to aiandmusic.esourcing.be? (when I do that I’ve got an Apache error because he can’t find the address.)
can someone help me?
Hello,
My first problem isn’t resole, but I’ve found other problem.
1° I can’t delete the comment and the article that are created by wordpress at the installation (I’ve finnaly delete it in mySQL but I have no ideai i it’s normal)
2° when I make a search, in the blog http://www.esourcing.be/aiandmusic, it search on http://www.esourcing.be and not in the aiandmusic blog.
Does anyone have the same problem and is there a solution?
Pages: « 1 … 2 3 [4] 5 6 » Show All