Wordpress Multi-domain
July 20th, 2008This is not Wordpress MU, but normal wordpress.
In order to make it multi domain you must have a bit knowledge of PHP.
First of all, just upload all wordpress files to your host as just normal. Then, point all wordpress domains to the installation directory.
Now, open wp-config.php and do some setting for all wordpress domains.
To make it easy, I’ll give you an example… assume I have 3 domain, domain1.com domain2.com and domain3.com, so part of my wp-config.php will look like this.
// ** MySQL settings ** //
define('DB_NAME', 'dbname'); // The name of the database
define('DB_USER', 'user'); // Your MySQL username
define('DB_PASSWORD', 'password'); // ...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
$current_sitename= $_SERVER['HTTP_HOST'];
if (($current_sitename == “domain1.com”) || ($current_sitename == “www.domain1.com”)){
$table_prefix = ‘domain1_’; // Only numbers, letters, and underscores please!
}elseif (($current_sitename == “domain2.com”) || ($current_sitename == “www.domain2.com”)){
$table_prefix = ‘domain2_’; // Only numbers, letters, and underscores please!
}elseif (($current_sitename == “domain3.com”) || ($current_sitename == “www.domain3.com”)){
$table_prefix = ‘domain3_’; // Only numbers, letters, and underscores please!
}
Now, save and upload wp-config.php , the setting is finished. Now, you can do the installation process as normal.
