WordPressTo be able to meet the needs of various types of websites, such as managing multiple independent websites on a single WordPress instance with a separate domain name for each website, you can enable the multi-site multi-domain feature of WordPress. Let's take a look at how to enable and configure the multidomain feature in WordPress to help manage multiple websites efficiently.
![图片[1]-如何在WordPress中启用多域名功能-光子波动网 | 专业WordPress修复服务,全球范围,快速响应](https://www.361sale.com/wp-content/uploads/2024/07/2024071502590045.png)
I. Preparatory work
Before you start configuring the multi-domain feature, prepare yourself:
1. Backup website data: Enabling multisite functionality will result in major changes to the site configuration, so back up all site data before doing so.
2. WordPress installation environment: Make sure yourWordPress InstallationThe environment meets the following conditions:
- It's generally usedThe latest version of WordPressAt this stage, we are usingWordPress 6.5.5The
- Appropriate server permissions (If the file has write permissions or has FTP).
- Accessing and editing the server'sWordPress filesThe
II. Enabling multi-site functionality
1. Modify the wp-config.php file.
First, in the WordPress root directory, find thewp-config.php
fileand in/* That's all, stop editing! Happy publishing. */
Add the following code above this line:
define('WP_ALLOW_MULTISITE', true);
Save fileLater.refresh (computer window)WordPress website backend.
2. Setting up the network
In the backend, there will be an additional file called "Setting up the network" option. Click "Setting up the network"Go to the Multisite Configuration page.
![图片[2]-如何在WordPress中启用多域名功能-光子波动网 | 专业WordPress修复服务,全球范围,快速响应](https://www.361sale.com/wp-content/uploads/2024/07/2024071901553758.jpg)
Here, the type of network needs to be selected:SubdomainmaybeSubdirectory. Wish to set up for each siteSeparate domain nameThe "So Choose"The "sub-domain" model is more appropriateThe
follow the promptsSet the information about the network, including the network title and administrator email, and then click "mounting".
III. Configuring a multi-site network
Once the installation is complete, you will need to follow the prompts to modify thewp-config.php
respond in singing.htaccess
file::
1.Modify the wp-config.php file: Add the following code towp-config.php
below the code previously inserted in the
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', true);
define('DOMAIN_CURRENT_SITE', 'example.com'); // Replace example.com with your main domain name
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1); define('BLOG_ID_CURRENT_SITE', 1);
2.Modify the .htaccess file: Will.htaccess
The contents of the file are replaced with the following code:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes). *) $1 [L]
RewriteRule ^(. *\.php)$ $1 [L] RewriteRule ^(.
RewriteRule . index.php [L] RewriteRule .
After saving the file, log back into the WordPress backend.
IV. Creation of new sites
After logging back in, you'll notice in the backend menu "My site"option, click on "network management"Under."website", then click on "Add new site":
- Enter the site address: InputSubdomains for new sitesaddress (e.g. newsite.example.com).
- Enter site title and administrator email: Fill in the title of the new site and the administrator email.
Click "Add site" button and wait for the new site to be generated.
V. Configuration of independent domain names
In order to use a separate domain name for a new site, the following steps need to be taken:
1. Configure domain name DNS records
Ensure that each individual domain name has resolved correctly to your server's IP address by setting up the correct DNS records. For example, configure thenewdomain.com
resolves to your server IP.
2. Installation and configuration of the Domain Mapping plug-in
![图片[3]-如何在WordPress中启用多域名功能-光子波动网 | 专业WordPress修复服务,全球范围,快速响应](https://www.361sale.com/wp-content/uploads/2024/07/2024071502545946.png)
In order for each site to use a separate domain name, it is possible to use theDomain Mappingplug-in (software component). Here are the exact steps:
1.Installation of plug-ins: In the network administration backend, go to the Plugins page, search for and install "WordPress MU Domain Mapping"Plugins.
2.Configuring Plug-ins: After the installation is complete, activate the plugin and configure it according to the following steps:
- Set the plugin directory in the
sunrise.php
The file is copied to thewp-content
Catalog. - modifications
wp-config.php
file, add the following code:
define('SUNRISE', 'on').
3.Setting up Domain Mapping: Go to "Settings"->"Domain Mapping" page to configure the primary domain name, and then set up individual domain names for each site in its admin page. For example, for newsitenewdomain.com
The
![图片[4]-如何在WordPress中启用多域名功能-光子波动网 | 专业WordPress修复服务,全球范围,快速响应](https://www.361sale.com/wp-content/uploads/2024/07/2024071503032525.png)
VI. Managing multiple sites
After completing the above configuration, you can add a new configuration to the "network management" under Manage All Sites, where each site can have separate themes, plugins and content. Here are some suggestions for managing multiple sites:
1. Theme and plugin management
You can install and manage themes and plugins centrally under "Network Management" and selectively enable or disable them for each site.
2. User management
Network administrators can manage users at all sites under "Network Management" and assign different privileges to each site.
3. Data backup and recovery
Make sure you back up all site data regularly, using plugins or manually backing up databases and files in case something unexpected happens.
reach a verdict
By following the steps above, the WordPressEnabling Multi-Domain Functionality. This feature can help you efficiently manage multiple independent websites, each of which can have a separate domain name and content. If you encounter any issues during the configuration process, feel free to contact the WordPress community or "Contact Us".
Link to this article:https://www.361sale.com/en/13607The article is copyrighted and must be reproduced with attribution.
No comments