Running multiple WordPress blogs with one installation

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:


$table_prefix  = 'yourblog_';


$domain  = $_SERVER['HTTP_HOST'];
if (stristr($domain, 'yourblogname1'))
�  $table_prefix  = 'yourblog1_';
else if (stristr($domain, 'yourblogname2'))
�  $table_prefix  = 'yourblog2_';
�  $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!

Tags: , , , ,

5 Responses to “Running multiple WordPress blogs with one installation”

  1. Lea Says:

    Is there be a way to add new domains to an already functioning wordpress installation? Your code works great, but I don’t want to lose everything that’s on my original site that’s currently on the wordpress installation. Wouldn’t a new install of wordpress delete all my current data and information?

  2. admin Says:

    Lea, that depends on your hosting company. For my server I can simply add a new domain or subdomain to the same account and let its root path point to the existing wordpress installation. That way nothing is lost and I can run multiple blogs with one installation.

  3. Lea Says:

    I’m showing how new I am to this with my following question. On my basic hosting plan I have one database and allowed one add on domain and one subdomain. I already had setup and running for several months. I just added as an add on domain.

    Its listed in my server files as home/nameid/public_html/ My problem is the redirect, I can’t figure out where it should be redirected to in order to initialize installation.

    Previously, acting under a misconception of the procedure, I got an installation command with the code you provided and installed onto my previously installed wordpress database, but I couldn’t access, so I removed the code from the config file in order to get that working again.

    I know installation is still on the database because it shows up in my plugin stats for the database.

    Database statistics

    mynewdomain_comments 0 Bytes 228 Bytes 6.14 kB 228 Bytes
    mynewdomain_links 1 140 Bytes 528 Bytes 4.10 kB 388 Bytes
    mynewdomain_options 101 5.66 kB 571.96 kB 10.24 kB 536 Bytes
    mynewdomain_postmeta 45 Bytes 228 Bytes 7.17 kB 0 Bytes
    mynewdomain_posts 14 452 Bytes 6.33 kB 6.14 kB 0 Bytes
    mynewdomain_term_relationships 21 Bytes 378 Bytes 3.07 kB 84 Bytes
    mynewdomain_term_taxonomy 2 42 Bytes 84 Bytes 3.07 kB 0 Bytes
    mynewdomain_terms 2 36 Bytes 72 Bytes 8.19 kB 0 Bytes
    mynewdomain_usermeta 7 89 Bytes 628 Bytes 7.17 kB 0 Bytes
    mynewdomain_users 1 96 Bytes 96 Bytes 4.10 kB 0 Bytes
    mycurrentblog_comments 228 Bytes 228 Bytes 6.14 kB 0 Bytes
    and etc.

    Since is already added to my server under home/nameid/public_html/, I’m confused as to where I should redirect it to before replacing your code in the config and be able to access both domains.

    Could you possibly help me with this?

  4. admin Says:

    Lea, with the current configuration you can only run it with a second wordpress which is ugly, because you have to keep both installations up-to-date.

    If you want one single wordpress, then you need to change the root-folder of That’s nothing that you can do a file system level. If your hosting company gives you an administration panel, look there. Otherwise contact your hosting company.

  5. Lea Says:

    Thank you for your quick response. I figured I might have to upgrade. As far as administration panel, I have C panel and PhPmyadmin, but I suspect those are not what you are talking about.

    If that’s the case, then I have to upgrade my hosting service. *sigh*