• The eternal confessions of a beautiful mind...
  • DamianM.Co.UK
  • Home
  • About
  • Archives
  • Contact
  • Sitemap
  • My Flickr

    IMG_9585IMG_9115IMG_9113IMG_9111IMG_9078IMG_9075IMG_9069IMG_9065IMG_9041IMG_9032IMG_8963IMG_8928IMG_8916IMG_8915IMG_8904IMG_8876IMG_8858IMG_8830IMG_8828IMG_8826

  • Recent Posts

    • New Ohio Roller Coaster - INSANE!!!
    • Speeding
    • Captions not required
    • Unfortunate Backgrounds
    • Unfortunate Signs
    • OMG!!
    • Women as explained by engineer
    • The Monty Hall Problem
    • ahhh still love them - Motivational Posters
    • What does Mona Lisa do when the Museum is closed………
    • 21st Century kids books
    • Cool Origami
    • AWESOME Pictures!
    • Things you shouldn’t find in your vegetable patch!
    • World’s Best Graffiti…?
  • My Tools

    • Blog_LinkIt
    • DCoda Theme
    • DCoda Widgets
    • RSS_Sticky
    • WordPress.org
    • WP_BlogNetworking
    • WP_BlogRollSync
    • WP_BoilerPlate
    • WP_Censor
    • WP_ContactMe
    • WP_DeliciousPost
    • WP_EasyReply
    • WP_HeadNFoot
    • WP_LinkIt
    • WP_OneInstall
    • WP_PostDate
    • WP_PostNotes
    • WP_RssSticky
    • WP_Spoiler
    • WP_Submission
  • My Web

    • ASPAlliance
    • ClaimID
    • del.ico.us
    • Digg
    • DSLRBlog
    • DVDProfiler
    • Flickr
    • Honeyed SPAM
    • My Blog
    • My company
    • MYSpace
    • WordPress.org
    • YouTube
    « Wordpress 2.3 upgrade
    CSS: liststyles inconsistencies »

    Multiple blogs, one installation.

    I have a number of blogs, one personal one for work, one for testing , development, one for training and one for demonstration and on occasion i have need for more. It became such a bind to keep all the installations and all the plugins on the installations current so i began to look for a solution.

    I first tried out WordpressMU this is a multi-user version of WordPress which shares most of the same code and is really for larger organisations to manage multiple blogs. Since its not 100% WordPress this wouldn’t work that well for my demo and testing installations, but most of all it seems to need URL rewriting and I’m on a windows platform that i can’t install the necessary drivers on i had to find an alternative.

    The simplest of solutions to the problem is to use WordPress and play around a little with the wp_config.PHP. wp_config contains everything WordPress needs to connect your blogs database.

    A regular wp_confifg will look a little like this

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    
    <?php
    // ** MySQL settings ** //
    define('DB_NAME', 'putyourdbnamehere');    // The name of the database
    define('DB_USER', 'usernamehere');     // Your MySQL username
    define('DB_PASSWORD', 'yourpasswordhere'); // ...and password
    define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value
    define('DB_CHARSET', 'utf8');
    define('DB_COLLATE', '');
     
    // You can have multiple installations in one database if you give each a unique prefix
    $table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!
     
    // Change this to localize WordPress.  A corresponding MO file for the
    // chosen language must be installed to wp-content/languages.
    // For example, install de.mo to wp-content/languages and set WPLANG to 'de'
    // to enable German language support.
    define ('WPLANG', '');
     
    /* That's all, stop editing! Happy blogging. */
     
    define('ABSPATH', dirname(__FILE__).'/');
    require_once(ABSPATH.'wp-settings.php');
    ?>

    As you can see the standard wp_config with the $table_prefix, to allow you to use one database for multiply blogs, if you replace this with a PHP switch statement you can easily access these blogs from the same installation.

    For example

    1
    2
    3
    4
    5
    6
    7
    8
    9
    
    switch (strtolower($_SERVER["SERVER_NAME"]))
    {
    case "www.site1.com":
    $table_prefix  = 'wp_site1_';
    break;
    case "www.site2.com":
    $table_prefix  = 'wp_test_';
    break;
    }

    You are not limited to using the same database, you could move the definitions for the host and user details into the case statement, but its best to keep it simple.

    I’ve been running my blogs like this for a few months now with no problems.

    Giveita try see is it works for you.

    This entry was posted on Monday, October 1st, 2007 at 5:00 pm and is filed under Wordpress. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

    One Response to “Multiple blogs, one installation.”

    1. Bonifaceby Says:
      March 20th, 2008 at 7:20 pm

      well done, man

    Leave a Reply