Multiblog WordPress: Eeek! No Database Connection
I tried browsing to www.kovshenin.com this morning and was pretty sure I’ll get the usual redirect, but no. I got an “Error establishing a database connection”. Right, it seems that www.kovshenin.com is not defined in the wp-config.php file we created earlier this week (Multiple Sites Driven By One WordPress Installation Part II) so here’s a workaround (and we’re switching back to example.org and example-two.org):
$wp_multi = array(
"example.org" => array(
"DB_NAME" => "example",
"DB_USER" => "example-user",
"DB_PASSWORD" => "example-pass",
"DB_HOST" => "example-host"
),
"example-two.org" => array(
"DB_NAME" => "example-two",
"DB_USER" => "example-two-user",
"DB_PASSWORD" => "example-two-pass",
"DB_HOST" => "example-two-host"
)
);
$server_name = str_replace("www." , "", strtolower($_SERVER["SERVER_NAME"]));
$wp_settings = $wp_multi[$server_name];
There. And we also got rid of an error we’d get if we typed eXamPle.org in the address bar.
I’m thinking of a way to wrap this up in some plugin or a little hack, or perhaps a super-short step-by-step tutorial, so that setting up multiple websites one a single wordpress bundle would be easier than ever. If you have any suggestions feel free to speak ;)
Sorry, but commenting on this post is closed. I tend to close comments on articles older that two weeks in order to avoid spam, however, if you still wish to say something, you can always reach me at any time on Twitter:
Tweet to @kovshenin
Sorry for the inconvenience and thank you so much for your patience!