好学IT学院:IT信息技术分享交流平台
标签:Wordpress  来源:互联网  作者:本站整理  发布时间:2011-02-15  ★★★加入收藏〗〖手机版
关于Wordpress开发网站绑定多个域名的方法
摘要:WordPress 是一个注重美学、易用性和网络标准的个人信息发布平台。有些人域名很多,但是只是搞了一个WP博客,所以就想给WP绑定多个域名,首页是没有问题的,关键是想连文章页面也是区分不同地址,刚好在群上看到这个一个信息,就顺手的转来给大家,需要的看下吧…

内容提示:WordPress 是一个注重美学、易用性和网络标准的个人信息发布平台。有些人域名很多,但是只是搞了一个WP博客,所以就想给WP绑定多个域名,首页是没有问题的,关键是想连文章页面也是区分不同地址,刚好在群上看到这个一个信息,就顺手的转来给大家,需要的看下吧,我虽然这个博客目前也启用了3个域名,但是我都不怎么管它的,我就是使用wpfair.com这个域名就够了。下面介绍具体操作方法:

需要注意的是,必须是Wordpress个人版,不能是WPMU版.而是怎么绑定到多个域名上去呢?当然你需要对php有一点了解才行。好了,废话少说,看操作方法。

首先,把wordpress所有文件上传到你的空间,然后把所有的域名指向到你的空间目录。

然后,打开wp-config.php,并进行如下编辑.为了简单一点,我提供几个例子,比如你有3个域名需要绑定,domain1.com,domain2.com,domain3.com,那么wp-config.php就会如下:

// ** MySQL settings by it.hxw.red ** //
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  by it.hxw.red** //
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!
}

好了,保存它并上传,现在,你可以像正常安装的办法来进行了.

Ajax技术初接触
  什么是Ajax?Ajax的定义Ajax不是一个技术,它实际上是几种技术,每种技术都有其独特这处,合在一起就成了一个功能强大的新技术…
  • 好学考试H5触屏版开放内测
  • 好学触屏公众号虎力全开、杨帆起航!