Previous post: Weblogs à  l’école

Next post: Missing Kitty

Musings on a Multiblog WordPress

by Stephanie on 08.11.2004

in Wanted, Weblog Technology

[fr]

Je réfléchis à comment on pourrait donner à WordPress la capacité de gérer plusieurs blogs avec une installation. Je me heurte à un problème concernant les includes PHP. Feedback et autres idées bienvenues!

[en]

Update June 2007: Try WordPress Multi-User now.

I’ve used Shelley’s instructions using soft links. I tried Rubén’s proof-of-concept, but got stuck somewhere in the middle.

So I started thinking: how can we go about making WordPress MultiBlog-capable? Here is a rough transcript of my thoughts (I’ve removed some of the dead ends and hesitations) in the hope that they might contribute to the general resolution of the problem. I have to point out my position here: somebody with a dedicated server who’s thinking of setting up a “WordPress weblog-farm” (for my pupils, mainly). So I’m aware that I’m not the “standard user” and that my solution is going to be impractical to many. But hey, let’s see where it leads, all the same. Actually, I think I probably reconstructed most of Rubén’s strategy here — but I’m not sure to what extent what I suggest differs from what he has done.

From a system point of view, we want to have a unique installation of WordPress, and duplication of only the files which are different from one blog to another (index.php, wp-config.php, wp-comments.php, wp-layout.css, to name a few obvious ones). The whole point being that when the isntall needs to be upgraded, it only has to be upgraded in one place. When a plugin is downloaded and installed, it only has to be done once for all weblogs — though it can of course be activated individually for each weblog.

From the point of view of the weblogs themselves, they need to appear to be in different domains/subdomains/folders/whatever. What I’m most interested in is different subdomains, so I’ll stick to that in my thinking. (Then somebody can come and tell me that my “solution” doesn’t work for subfolders, and here’s one that works for subfolders and subdomains, and we’ll all be happy, thankyouverymuch.) So, when I’m working with blog1.example.com all the addresses need to refer to that subdomain (blog1.example.com/wp-admin/, etc); ditto for blog2.example.com, blog3.example.com, blogn.example.com (I used to like maths in High School a lot).

As Rubén puts it, the problem with symbolic links (”soft links”) is called “soft link hell”: think of a great number of rubber bands stretched all over your server. Ugh. So let’s try to go in his direction, for a while. First, map all the subdomains to the same folder on the server. Let’s say blog1.example.com, blog2.example.com (etc.) all point to /home/bunny/www/wordpress/. Neat, huh? Not so. They will all use the same wp-config.php file, and hence all be the same weblog.

This is where Rubén’s idea comes in: include a file at the top of wp-config.php which:

  1. identifies which blog we are working with (in my case, by parsing $HTTP_HOST, for example — there might be a more elegant solution)
  2. “replaces” the files in the master installation directory by the files in a special “blog” directory, if they exist

The second point is the tricky one, of course. We’d probably have a subfolder per blog in wordpress/blogs: wordpress/blogs/blog1, wordpress/blogs/blog2, etc. The included file would match the subdomain string with the equivalent folder, check if the page it’s trying to retrieve exists in the folder, and if it does, include that one and stop processing the initial script after that. Another (maybe more elegant) option would be to do some Apache magic (I’m dreaming, no idea if it’s possible) to systematically check if a file is available in the subdirectory matching the subdomain before using the one in the master directory. Anybody know if this is feasible?

The problem I see is with includes. We have (at least) three types of include calls:

  • include (ABSPATH . 'wp-comments.php');
  • require ('./wp-blog-header.php');
  • require_once(dirname(__FILE__).'/' . '/wp-config.php');

As far as I see it, they’ll all break if the calling include is in /home/bunny/www/wordpress/blogs/blog1 and the file to be called is in /home/bunny/www/wordpress. What is wrong with relative includes? Oh, they would break too. Dammit.

We would need some intelligence to determine if the file to be included or called exists in the subdirectory or not, and magically adapt the include call to point to the “right” file. I suspect this could be done, but would require modifying all (at least, a lot of) the include/requires in WordPress.

Maybe another path to explore would be to create a table in the database to keep track of existing blogs, and of the files that need to be “overridden” for each blog. But again, I suspect that would mean recoding all the includes in WordPress.

Another problem would be .htaccess. Apache would be retrieving the same .htaccess for all subdomains, and that happens before PHP comes into play, if I’m not mistaken.

Any bright ideas to get us out of this fix? Alternate solutions? Comments? Things I missed or got wrong? The comments and trackbacks are yours. Thanks for your attention.

{ 8 trackbacks }

Netlex News
08.16.2004 at 9:45
59 Ideas » Blog Archive » links for 2006-02-18
02.18.2006 at 19:19
Chris Brunner .com
06.09.2006 at 4:13
Weblog Tools Collection
08.20.2006 at 22:02
Wordpress: Installing Multiple Blogs | A Blog you can use
05.16.2007 at 12:48
IM2 | OQP » Ferme de blogues avec Wordpress
09.05.2007 at 0:55
Thorsten´s Blogosphere » Blog Archiv » multiple Wordpressblogs for a weblog farm
11.22.2007 at 11:28
Tonight at The smart way to web design and development in 2008
01.08.2008 at 4:45

{ 38 comments… read them below or add one }

1 eBlog 08.11.2004 at 11:49

ASA WP is multiblog I'll run it.

2 eBlog 08.11.2004 at 12:49

ASA WP is multiblog I’ll run it.

3 Ollie 08.13.2004 at 8:12

This may be helpful: http://wordlog.com/index.php?p=51

4 Ollie 08.13.2004 at 9:12

This may be helpful: http://wordlog.com/index.php?p=51

5 Netlex News 08.16.2004 at 8:45

Multiblog : une page unique pour de multiples utilisateurs
Comment créer un “multiblog” avec Wordpress ?

Allan sur Mertner.com a trouvé une solution qui permet à  chaque utilisateur d'afficher sur le même site Wordpress leurs propres articles.

via Mertner.Com Family Blogs - An Experiment In Multip…

6 Donncha 08.22.2004 at 12:34

I'm working on multi blog support and also on getting Smarty into WP too. Smarty is almost working fine, without caching, but the multi-blog stuff is hard if you want to run all the blogs on one host.
I went for the “thin layer” solution - mod_rewrite rules break up the URL and change URLs so that a “wpblog” variable is set to the name of the blog. A stripped down wp-config includes a wp-blogs/BLOGNAME/wp-config.php and then processing continues.
Unfortunately, I'm not an expert at writing mod_rewrite rules and it's proving to be a stumbling block.
In b2++ I redirect all requests to a redirect.php, but that turned out to be a very complex solution - I needed lots of PHP code to figure out what the URL contained. I'd rather have a thin layer any day!

7 Donncha 08.22.2004 at 13:34

I’m working on multi blog support and also on getting Smarty into WP too. Smarty is almost working fine, without caching, but the multi-blog stuff is hard if you want to run all the blogs on one host.
I went for the “thin layer” solution - mod_rewrite rules break up the URL and change URLs so that a “wpblog” variable is set to the name of the blog. A stripped down wp-config includes a wp-blogs/BLOGNAME/wp-config.php and then processing continues.
Unfortunately, I’m not an expert at writing mod_rewrite rules and it’s proving to be a stumbling block.
In b2++ I redirect all requests to a redirect.php, but that turned out to be a very complex solution - I needed lots of PHP code to figure out what the URL contained. I’d rather have a thin layer any day!

8 CaptSolo 09.13.2004 at 10:28

Considering multi-blog setup, you should look at the b2evolution.

It is an advanced blog engine, based on b2/cafelog - the same roots as WordPress.

In b2evolution the multi-blog feature is included by default and it has been there for some time already. There is also a fine-grained access control per user/blog/operations - you may enable one user to have full access to one blog and no access to other (for example).

Main developer's blog (Francois Planque blog) is a fine example of a multi-blog. It also has UTF-8 support, skins (may be different for each blog), hierarchical categories.

This does not imply you absolutely have to use b2evolution - but even if implementing multi-blog in WP, you may see how it works in b2evo. :)

9 CaptSolo 09.13.2004 at 11:28

Considering multi-blog setup, you should look at the b2evolution.

It is an advanced blog engine, based on b2/cafelog - the same roots as WordPress.

In b2evolution the multi-blog feature is included by default and it has been there for some time already. There is also a fine-grained access control per user/blog/operations - you may enable one user to have full access to one blog and no access to other (for example).

Main developer’s blog (Francois Planque blog) is a fine example of a multi-blog. It also has UTF-8 support, skins (may be different for each blog), hierarchical categories.

This does not imply you absolutely have to use b2evolution - but even if implementing multi-blog in WP, you may see how it works in b2evo. :)

10 essdsm 10.02.2004 at 12:36

The b2Evolution solution doesn't appear to be a scalable solution because human beings still have to create multiple blogs. Work in an institution with thousands of students and it just don't work. In essence we want to take some basic details either from direct user entry or pulled in from authentication/authorization systems and then autogenerate the blog instance, a la Blogger.com

11 essdsm 10.02.2004 at 13:36

The b2Evolution solution doesn’t appear to be a scalable solution because human beings still have to create multiple blogs. Work in an institution with thousands of students and it just don’t work. In essence we want to take some basic details either from direct user entry or pulled in from authentication/authorization systems and then autogenerate the blog instance, a la Blogger.com

12 birdboot 12.22.2005 at 7:00

Did you ever get any further with this? I would like to implement a multiblog solution which enables authenticated users to automatically set up blogs. LDAP authentication would provide all the information needed to do the setup.

13 birdboot 12.22.2005 at 9:00

Did you ever get any further with this? I would like to implement a multiblog solution which enables authenticated users to automatically set up blogs. LDAP authentication would provide all the information needed to do the setup.

14 hbee 02.04.2006 at 22:09

As to B2E, I'd be fairly careful. I used the multiblog option to separate content and it works very nicely - BUT -
1) dealing with comment spam was a nightmare since 25% of the time the antispam tool denied me access the antispam page.
2) simple linking frequently took forever to work correctly
(In fairness, I never took the time to troubleshoot these two issues, so who knows why it happened)
3) B2E takes up an awful lot of server load. My webhost (spookymedia.com) told me that several hosts refuse to allow users to run it. Her solution was a server accelerator that worked by using my own bandwidth to cache pages. Thus, using B2E cost me about an eighth of my bandwidth. It was good motivation to move me to WP, though.

15 hbee 02.04.2006 at 23:09

As to B2E, I’d be fairly careful. I used the multiblog option to separate content and it works very nicely - BUT -
1) dealing with comment spam was a nightmare since 25% of the time the antispam tool denied me access the antispam page.
2) simple linking frequently took forever to work correctly
(In fairness, I never took the time to troubleshoot these two issues, so who knows why it happened)
3) B2E takes up an awful lot of server load. My webhost (spookymedia.com) told me that several hosts refuse to allow users to run it. Her solution was a server accelerator that worked by using my own bandwidth to cache pages. Thus, using B2E cost me about an eighth of my bandwidth. It was good motivation to move me to WP, though.

16 Chris Brunner .com 06.09.2006 at 4:13

Switching from b2evolution to WordPress…

Like many others, I’ve decided to ditch b2evolution in favor of WordPress.’  The biggest reasons were:

b2evolution has almost no protection against spam.’  They have this goofy little centralized blacklist that’s maintained by one person a…

17 Weblog Tools Collection 08.20.2006 at 22:02

Stephanie Booth’s Musings on a Multiblog WordPress…

Climb to the Stars >> Musings on a Multiblog WordPress: Some interesting thoughts there and I could add some of my own but I have been waiting for *********’s proof of concept to surface. I personally believe that rather than trying to re-enginee…

18 Jose Alfredo Muñoz Longinos 05.23.2007 at 15:45

I have some questions about of Wordpres MU. How to install on Windows 2003 server for multiblogs. I don’t have experience with blogs.

19 Jose Alfredo Muñoz Longinos 05.23.2007 at 15:45

I have some questions about of Wordpres MU. How to install on Windows 2003 server for multiblogs. I don't have experience with blogs.

20 turox 06.20.2007 at 16:23

There’s a way to install multiple blogs in different folders (/domains/www/domain1.com, /domains/www/domain2.com, /domains/www/domain3.com) using separated databases?

I mean, an automatic installation, I have to install 1,000 WP blogs :( for a customer and I only have 40 blogs installed…

any advice?

thanks,

Turox

21 turox 06.20.2007 at 16:23

There's a way to install multiple blogs in different folders (/domains/www/domain1.com, /domains/www/domain2.com, /domains/www/domain3.com) using separated databases?

I mean, an automatic installation, I have to install 1,000 WP blogs :( for a customer and I only have 40 blogs installed…

any advice?

thanks,

Turox

22 turox 06.20.2007 at 16:26

of course, i have full access to the server (mysql admin, root password, etc)

23 turox 06.20.2007 at 16:26

of course, i have full access to the server (mysql admin, root password, etc)

24 turox 06.20.2007 at 16:28

i was trying to create a php script to do this, but just got stuck :’(

25 turox 06.20.2007 at 16:28

i was trying to create a php script to do this, but just got stuck :'(

26 Stephanie 06.20.2007 at 16:32

You should probably try http://mu.wordpress.org/ is you have 1000 blogs to set up…

27 Stephanie 06.20.2007 at 16:32

You should probably try http://mu.wordpress.org/ is you have 1000 blogs to set up…

28 Umesh 07.09.2007 at 15:11

Setting up multiple blogs using mu.wordpress.org is fine but what I am looking for is a common user database. I want user authentication to be the same across all blogs. How can we do that in mu.

29 Umesh 07.09.2007 at 15:11

Setting up multiple blogs using mu.wordpress.org is fine but what I am looking for is a common user database. I want user authentication to be the same across all blogs. How can we do that in mu.

30 59 Ideas 09.05.2007 at 22:52

3 years down the road and still some hacking required …

31 59 Ideas 09.05.2007 at 22:52

3 years down the road and still some hacking required …

32 Surya 10.08.2007 at 17:24

Thanks for your guide and information,

I’ll create multiple blog in my domain,
Now, I got the guide

thanks

33 Surya 10.08.2007 at 17:24

Thanks for your guide and information,

I'll create multiple blog in my domain,
Now, I got the guide

thanks

34 Velia Pola 03.02.2008 at 16:52

I am hoping someone can advise me as to how to install Worpdress MU on the same url (or a subdomoain?) as my existing Wordpress site. I want to keep my basic existing site on MU but set up a member/sitename area with MU. My MU installation defaults to a 404 page. Can the two programs co-exist?
Any help would be appreciated.

35 Velia Pola 03.02.2008 at 16:54

Sorry, I meant keep the existing site with Wordpress, but have the members blogs on MU

36 Velia Pola 03.02.2008 at 17:52

I am hoping someone can advise me as to how to install Worpdress MU on the same url (or a subdomoain?) as my existing Wordpress site. I want to keep my basic existing site on MU but set up a member/sitename area with MU. My MU installation defaults to a 404 page. Can the two programs co-exist?
Any help would be appreciated.

37 Velia Pola 03.02.2008 at 17:54

Sorry, I meant keep the existing site with Wordpress, but have the members blogs on MU

38 test 10.27.2008 at 11:46

test

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

« Back to text comment

Additional comments powered by BackType

Clicky Web Analytics