Multiple blogs with a single WordPress installation


When I started setting up the blogs some days ago, I began to create subdomains and subdirectories on the server where I could install WordPress. Soon I discovered, how complicated and prone to errors this procedure can be and started to think about alternatives allowing me to run several separate blogs while administrating and maintaining only a single software installation. You can find some more or less complex hacks for this floating around the net. In addition there exists a special multi user/multi blog version of WordPress called WordPress µ, but it seems it is turned mostly towards very large projects and uses a number of modifications of the original variant for this purpose. On the other hand there is an approach by Strider which is called Virtual Multiblog and looks quite feasible. However this looks a bit intricately at first glance because it seems to require an additional WordPress plugin.

Finally I discovered a very elegant way by myself: Because WordPress stores all settings of a blog – including articles, comments and users – in the MySQL tables defined in the file wp-config.php, it would be sufficient to use different configuration files depending on the used subdomain. So I modified the wp-config.php to simply evaluate the used subdomain and load a configuration based on the result. Which looks like this:

if ($_SERVER['SERVER_NAME'] == '')
else if ($_SERVER['SERVER_NAME'] == '')

The files wp-config.blog1.php and wp-config.blog2.php are just standard WordPress configuration scripts without a single line of extra code. Using different prefixes for the MySQL tables it even would be sufficient to have a single database to store all blogs. As simple as it is, as low-maintenance it is too, because WordPress updates don’t overwrite the new wp-config.php or the newly created configuration files. At the same time all blogs benefit from the update, of course.

[Update: It just caught my eye, that you might run into difficulties if you are running multiple blogs with the same plugin. If an upgrade of that plugin requires an update of the plugin’s database table, you have to pay attention to update all of those tables (for every blog using the plugin)!]

Author: Tobias

Hallo, ich bin Tobias. Meine Leidenschaft gilt alten Autos. Je ausgefallener desto besser. Im Alltag schwöre ich auf meinen treuen '88 Volvo 745 und im Laufe der Zeit sammelten sich daneben in der Garage noch ein '79 AMC Pacer, ein '70 Chrysler 300 Hurst, ein '90 Toyota Sera und ein '94 Mazda 121 Ginza. Wenn ich gerade nicht an den Autos herumschraube, lasse ich den Nerd raushängen und schreibe hier irgendwas zu Online- und IT-Themen, Filmen oder Musik. Ihr findet mich auch .


Leave a Reply

Required fields are marked *.