Wordpress Multi-domain
注意,不是WPMU版,而是Wordpress个人版,怎么绑定到多个域名上去呢?当然你需要对php有一点了解才行。
首先,把wordpress所有文件上传到你的空间,然后把所有的域名指向到你的空间目录。
然后,打开wp-config.php,并进行如下编辑。为了简单一点,我提供几个例子,比如你有3个域名需要绑定,domain1.com,domain2.com,domain3.com,那么wp-config.php就会如下:
// ** 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!
}
This 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.
好了,保存它并上传,现在,你可以像正常安装的办法来进行了