You and Me ,He and She ,EveryOne Is Angel. EveryOne Has His Angel.

单个WP多域名绑定的办法[Wordpress Multi-domain]

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.

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

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google

24 Responses to “单个WP多域名绑定的办法[Wordpress Multi-domain]”

  1. Its just sometimes people seem to get themselves tied up in unnecessary knots over something that

  2. Thank you for a great blog, I will be sure to bookmark your site and check back later :)

  3. 望这个帖子,能够让大家回忆起自己在CWOW里最初的那份发自心底的感动,毕竟现在CWOW乌烟瘴气,很多人去意已决,论坛里又是是非非,口诛笔伐不短,已经不是最初的CWOW那么让人留念了。。。。但是有些人,有些事,总是让我们坚定着信念:感动,155

  4. Seems like you really took your time on this. Keep up the good work! :)

  5. Its just sometimes people seem to get themselves tied up in unnecessary knots over something that

  6. This blog makes me want to start my own blog.

  7. qwertyuiop What theme is this? Can’t wait to start my own blog.

  8. asdcasdfsf I don’t usually post but I enjoyed your blog a lot.

  9. Nice blog! Can’t wait to start my own blog. reciprocal link checker

  10. I liked your blog a lot.

  11. I just wanted to ask you if you like pineapples? No, don’t be like O.o. Just say if you like them. It’s important lol

  12. Аренда автомобилейкиев, прокат , услуги лимузинов

  13. The personal loans seem to be useful for guys, which would like to organize their own career. As a fact, that’s easy to receive a credit loan.

  14. This is a great article. Thank you very much for the great article you shared! I was finding for this article for a long time, but I was not able to find a dependable source.

  15. Thank you for another good article. Where else could anybody get this kind of info in such a easy to understand way of presentation.

  16. Thank you very much for the info provided! I was looking for this info for quite some time, but I wasn’t able to see a trusted source.

  17. I had fun reading it. I want to see more on this topic.. Thank you for writing this nice article.. Anyway, I’m gonna subscribe to your rss and I hope you write great articles again soon.

  18. I’ll stick a link to this blog on my blog. I am certain my readers will find this article very great.

  19. Thank you for another great article. Where else would anyone get this kind of info in such a easy to understand way of presentation.

  20. I’ll stick a link to this blog on my website. I’m certain my visitors will think of this info really informative.

  21. Thanks for providing valuable post about the topic. I am a fan of your site. Keep up the great job.

  22. This is a great article. Thank you very much for the excellent post you shared! I was looking for this entry for a long time, but I wasn’t able to find a dependable source.

  23. Lenen zonder BKR toetsing gaat vandaag heel gemakkelijk. Binnen een paar uur geld lenen zonder BKR toetsing doet u hier, lees snel verder

  24. Migraine is een bonzende hoofdpijn die meestal voorkomt aan één kant van de schedel. De pijn is heftig en houdt 4 tot 72 uur aan

Leave a Reply