Created
October 14, 2013 23:07
-
-
Save bMinaise/6983781 to your computer and use it in GitHub Desktop.
Multiple Domains using one WP install
From http://wordpress.org/support/topic/multiple-domains-using-one-wp-install-not-wpmu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Determining the domain - DO NOT EDIT */ | |
$host = $HTTP_HOST; | |
$parts = explode('.',$host); | |
if ($parts[3] = "") { | |
$domain = $parts[0]; | |
} else { | |
$domain = $parts[1]; | |
} | |
/* Domain - Edit below. Add more "cases" for each domain you want to have. | |
Make sure each "case" has a "break; line at the end. */ | |
switch ($domain) { | |
case "domain1": // "domain" in "www.domain.com" | |
$db = "database1"; // the database for this domain | |
$user = "username1"; // the username for this database | |
$password = "pass1"; // the password for this database | |
$hostname = "localhost"; // 99% chance you won't need to change this value | |
$table_prefix = 'wp_'; // change for multiple installations in one database | |
$wplang = ''; // change to localize wordpress (must have an MO file in wp-includes/languages) | |
break; | |
case "domain2": // "domain" in "www.domain.com" | |
$db = "database2"; // the database for this domain | |
$user = "username2"; // the username for this database | |
$password = "pass2"; // the password for this database | |
$hostname = "localhost"; // 99% chance you won't need to change this value | |
$table_prefix = 'wp_'; // change for multiple installations in one database | |
$wplang = ''; // change to localize wordpress (must have an MO file in wp-includes/languages) | |
break; | |
} | |
/* That's all, stop editing! Happy multi-blogging. */ | |
define('DB_NAME', $db); | |
define('DB_USER', $user); | |
define('DB_PASSWORD', $password); | |
define('DB_HOST', $hostname); | |
define('DB_CHARSET', 'utf8'); | |
define('DB_COLLATE', ''); | |
define ('WPLANG', $wplang); | |
define('ABSPATH', dirname(__FILE__).'/'); | |
require_once(ABSPATH.'wp-settings.php'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment