|

How To Clone WordPress Multisite To A New Domain?

A Step-by-Step Guide to Migrating WordPress Multisite

Issue: Copied WordPress multisite including database with abc.com URL to the “abc” folder in my shared hosting account. Then pointed another domain newwebsite.com to the original installation without changing references to abc.com. Now all the admin URLs pointing to abc.com instead of newwebsite.com. How do I make sure both installations will work independently without cross referencing. 

A Step-by-Step Guide to Migrating WordPress Multisite
A Step-by-Step Guide to Migrating WordPress Multisite

Because WordPress Multisite hardcodes URLs in multiple database tables and configuration files, simply copying the files and database isn’t enough. The new installation is still reading the old domain from the copied database and configuration, which forces the redirects back to the original site.

To completely separate the two installations so they operate independently, you must update the configuration file and core database tables on the new installation.

Verify Database Independence

Before proceeding, open the wp-config.php file in the abc folder and ensure it is connected to a new, separate database (or uses a different table prefix). If both wp-config.php files point to the exact same database, making these changes will break the original abc.com site.

1. Update wp-config.php

File Manager

Open your shared hosting File Manager, navigate to the abc folder, and edit the wp-config.php file. Locate the Multisite constants and update DOMAIN_CURRENT_SITE to your new domain.

PHP

define( 'DOMAIN_CURRENT_SITE', 'newwebsite.com' );

Verification: If you try loading the site now, it will likely give a database error or still redirect, but the core configuration is now pointing to the new domain.

2. Update core network tables

phpMyAdmin

Log into phpMyAdmin from your hosting control panel, select the new database connected to newwebsite.com, and update the domain in the following network tables:

  • wp_site: Edit the single row and change the domain column to newwebsite.com.
  • wp_sitemeta: Search for the meta_key named siteurl and change its meta_value to [https://newwebsite.com](https://newwebsite.com).
  • wp_blogs: Edit the row for blog_id 1 (and any other sub-sites) and change the domain column to newwebsite.com.

3. Update options for the main site

phpMyAdmin

In the same database, open the wp_options table. Locate the siteurl and home rows (usually the first two rows) and change their option_value from [https://abc.com](https://abc.com) to [https://newwebsite.com](https://newwebsite.com).

Note: If you have other sub-sites on this network, you must repeat this for each site’s options table (e.g., wp_2_options, wp_3_options).

Verification: At this point, you should be able to log into [https://newwebsite.com/wp-admin](https://newwebsite.com/wp-admin) without being redirected to the old site.

4. Perform a serialization-safe Search and Replace

wp-admin

Because WordPress stores many URLs in serialized data (like widget settings and page builder layouts), running a simple SQL query will corrupt the database.

  1. Log into your newly accessible [newwebsite.com/wp-admin](https://newwebsite.com/wp-admin).
  2. Install and activate a plugin like Better Search Replace.
  3. Search for abc.com and replace it with newwebsite.com.
  4. Select all tables and uncheck “Run as dry run” to execute.

Verification: Click through the front-end pages of the new site and inspect the images and internal links; they should all now point to newwebsite.com.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *