单个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.
好了,保存它并上传,现在,你可以像正常安装的办法来进行了






September 18th, 2009 at 1:41 am
Its just sometimes people seem to get themselves tied up in unnecessary knots over something that
September 23rd, 2009 at 2:03 pm
Thank you for a great blog, I will be sure to bookmark your site and check back later
September 26th, 2009 at 12:15 pm
望这个帖子,能够让大家回忆起自己在CWOW里最初的那份发自心底的感动,毕竟现在CWOW乌烟瘴气,很多人去意已决,论坛里又是是非非,口诛笔伐不短,已经不是最初的CWOW那么让人留念了。。。。但是有些人,有些事,总是让我们坚定着信念:感动,155
October 3rd, 2009 at 11:10 am
Seems like you really took your time on this. Keep up the good work!
October 29th, 2009 at 9:38 am
Its just sometimes people seem to get themselves tied up in unnecessary knots over something that
November 17th, 2009 at 10:36 am
This blog makes me want to start my own blog.
March 6th, 2010 at 8:10 pm
qwertyuiop What theme is this? Can’t wait to start my own blog.
March 7th, 2010 at 5:28 am
asdcasdfsf I don’t usually post but I enjoyed your blog a lot.
March 17th, 2010 at 10:22 am
Nice blog! Can’t wait to start my own blog. reciprocal link checker
April 2nd, 2010 at 7:16 pm
I liked your blog a lot.
May 14th, 2010 at 8:06 am
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
June 16th, 2010 at 12:20 pm
Аренда автомобилейкиев, прокат , услуги лимузинов
June 30th, 2010 at 12:46 am
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.
July 17th, 2010 at 11:00 pm
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.
July 17th, 2010 at 11:06 pm
Thank you for another good article. Where else could anybody get this kind of info in such a easy to understand way of presentation.
July 18th, 2010 at 3:00 am
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.
July 19th, 2010 at 4:44 am
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.
July 21st, 2010 at 3:05 am
I’ll stick a link to this blog on my blog. I am certain my readers will find this article very great.
July 21st, 2010 at 3:34 am
Thank you for another great article. Where else would anyone get this kind of info in such a easy to understand way of presentation.
July 21st, 2010 at 6:09 am
I’ll stick a link to this blog on my website. I’m certain my visitors will think of this info really informative.
July 22nd, 2010 at 8:05 am
Thanks for providing valuable post about the topic. I am a fan of your site. Keep up the great job.
July 22nd, 2010 at 10:17 am
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.
July 24th, 2010 at 3:12 am
Lenen zonder BKR toetsing gaat vandaag heel gemakkelijk. Binnen een paar uur geld lenen zonder BKR toetsing doet u hier, lees snel verder
July 25th, 2010 at 6:06 pm
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