Posts Tagged ‘multiple installations’

Running multiple WordPress blogs with one installation

Wednesday, August 20th, 2008

When trying to run this blog with the same installation as my “Outlook and Sync blog“, I found out that this was more difficult than expected. WordPress doesn’t have a readymade feature for this, you have to do some tricks. And most of the tricks that I found were pretty difficult or involved several steps.

Here’s a trick that is easier. It requires that:

  • The different blogs should be on different domains or subdomains
  • The blogs should take up the entire (sub)domain (so they shouldn’t start in a subfolder)

Then it’s quite easy. Simply configure all the blog’s domains to point to the same WordPress installation folder. You can probably do this in the configuration panel of your webspace provider.

Now edit the wp-config.php:

Before:

$table_prefix  = 'yourblog_';

After:

$domain  = $_SERVER['HTTP_HOST'];
if (stristr($domain, 'yourblogname1'))
�  $table_prefix  = 'yourblog1_';
else if (stristr($domain, 'yourblogname2'))
�  $table_prefix  = 'yourblog2_';
else
�  $table_prefix  = 'yourblog_';

As a nice side effect you’re only needing one database instance for this (they’re often limited in rented webspace) and just have more tables in the same database. All blogs use the same installed files, but have different content and can have different layouts and activated plugins.

Happy Blogging!