How to Enable Multiple Domains in WordPress

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修复服务,全球范围,快速响应

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.phpfileand 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修复服务,全球范围,快速响应

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.phprespond in singing.htaccessfile::

1.Modify the wp-config.php file: Add the following code towp-config.phpbelow 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.htaccessThe 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":

  1. Enter the site address: InputSubdomains for new sitesaddress (e.g. newsite.example.com).
  2. 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.comresolves to your server IP.

2. Installation and configuration of the Domain Mapping plug-in

图片[3]-如何在WordPress中启用多域名功能-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

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 thesunrise.phpThe file is copied to thewp-contentCatalog.
  • modificationswp-config.phpfile, 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.comThe

图片[4]-如何在WordPress中启用多域名功能-光子波动网 | 专业WordPress修复服务,全球范围,快速响应

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".


Contact Us
Can't read the article? Contact us for free answers! Free help for personal, small business sites!
Tel: 020-2206-9892
QQ咨询:1025174874
(iii) E-mail: info@361sale.com
Working hours: Monday to Friday, 9:30-18:30, holidays off
© Reprint statement
This article was written by Harry
THE END
If you like it, support it.
kudos0 share (joys, benefits, privileges etc) with others
commentaries sofa-buying

Please log in to post a comment

    No comments