![图片[1]-WordPress 绑定多个域名教程,使多个域名可访问同一个WordPress站点-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/uploads/2024/04/website-Speed.png)
Tutorial ideas: the need to bind the domain name, we first set up a new website in Pagoda, and then let the site to use the A station WordPress program files, and finally add the corresponding code in the program files to achieve the effect of multiple domain names to access the same site.
Note: The following example: www.123.com is the initial website, and the domain name to be added is www.a.com www.b.com www.c.com等等.
1, the establishment of the need to bind the domain name for the new site
First of all, the need to bind the domain name, add the site in the Pagoda, and modify the site root directory for the initial site www123.com the same directory, submit and save. (i.e. more than one new website to access the same website program files).
![图片[2]-WordPress 绑定多个域名教程,使多个域名可访问同一个WordPress站点-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/uploads/2024/04/PixPin_2024-04-16_16-35-22-1.png)
![图片[3]-WordPress 绑定多个域名教程,使多个域名可访问同一个WordPress站点-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/uploads/2024/04/PixPin_2024-04-16_16-36-58.png)
![图片[4]-WordPress 绑定多个域名教程,使多个域名可访问同一个WordPress站点-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/uploads/2024/04/PixPin_2024-04-16_16-38-17.png)
2, the following changes to the code.
Locate the wp-config.php file, open the editor and find the define('WP_DEBUG', false). This line of code, add the following code below him. As shown in the figure below:
![图片[5]-WordPress 绑定多个域名教程,使多个域名可访问同一个WordPress站点-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/uploads/2024/04/PixPin_2024-04-16_16-42-59.png)
![图片[6]-WordPress 绑定多个域名教程,使多个域名可访问同一个WordPress站点-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/uploads/2024/04/PixPin_2024-04-16_16-44-14.png)
$domain = array("www.a.com", "www.b.com", "www.c.com");
if(in_array($_SERVER['HTTP_HOST'], $domain)){
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
}
The www.a.com, www.b.com, www.c.com are the domain names to be bound, just replace them with your own desired domain names.
After the above modification of the domain name operation will not modify the domain name part of the path of these attachments, so it is also necessary to modify the address of the static file, using the following code can be solved (added in the next line of the above code):
define('WP_CONTENT_URL','/wp-content');
In this way, a website is completed to bind multiple domain names.
Link to this article:https://www.361sale.com/en/8004/The article is copyrighted and must be reproduced with attribution.
















![表情[wozuimei]-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/themes/zibll/img/smilies/wozuimei.gif)
![表情[baoquan]-光子波动网 | WordPress教程、Elementor教程与故障修复](https://www.361sale.com/wp-content/themes/zibll/img/smilies/baoquan.gif)

No comments