Host multiple blogs with default WordPress?


WordPress icon.

Vinícius Lira over in this comments thread has proposed a ridiculously elegant solution to using a default WordPress installation to host multiple blogs on different databases. If it works, it's genius.

  1. Create a subdomain that points to your WordPress installation, such as

  2. Create a new database, such as newblog

  3. Edit the wp-config.php file and replace:

    define('DB_NAME', 'wordpress');


    if($_SERVER['HTTP_HOST'] == "" or
    $_SERVER['HTTP_HOST'] == "") {
    	define('DB_NAME', "mysitedatabase");
    elseif ($_SERVER['HTTP_HOST'] == "") {
    	define('DB_NAME', "newblog");

Haven't tested it myself yet, but it seems too simple. It shouldn't work. If it does, it'd be schweet.

Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.