Type of WP Migration:
- Full WP migration
- WP Singlesite to WP Singlesite
- WP Multisite to WP Multisite
- WP Singlesite to WP Singlesite different domain name
- WP Multisite to WP Multisite different Net-Site domain name
- One Site migration
- WP Singlesite to WP Multisite Sub-site
- WP Singlesite to WP Multisite Net-site
- WP Multisite Net-site to WP Singlesite
- WP Multisite Sub-site to WP Singlesite
- WP Multisite Net-site to WP Multisite Net-site
- WP Multisite Net-site to WP Multisite Sub-site
- WP Multisite Sub-site to WP Multisite Net-site
- WP Multisite Sub-site to WP Multisite Sub-site
The best strategy for a one site migration is: grab a site into a WP site backup set, that can be uploaded to WP Singlesite, WP Multisite Net-site or WP Multisite Sub-site.
Standard Manual Site Migration
Migrating single site or single multi-site (not the root multi-site/main network site), to or from single-site or multi-site WP Host, can be done manually:
- Create a new site on Target WP Host, resolved by its Target Domain Name.
For migrating to new domain with secure certificate (HTTPS), make sure the SSL already installed and https://targetdomain.com already resolved to the new site.
For migrating same domain, keep the old http or https://samedomain.com, and use a temporary name on Target WP Host: http or https://temp.samedomain.com.
- Install / update Target WP Host to match Source WP Host
Admin email: Both Host must have same admin email and the admin user registered.
Plugins: Both Host must have same plugins installed.
Themes: Both Host must have same active theme installed. Remove unused Themes.
Site Settings: Both Host must have same site setting.
If both host not exactly the same it will only add some risk. Most of the time the migration will succeed.Multisite must have MU Domain Mapping pluggins, and note the Site ID number from Network Admin – Settings – Domain. The number is marking table prefix for each site on multi-site WP.Install Maintenance plugins.
Plugins: disable plugins that is not critical
Themes: disable themes that is not critical
- Create backup of Target WP Host
- Copy Source WP Host site files
wp-plugins (if customization made here)
wp-themes (if customization made here)
other files for the site that is not part of core WP.For single-site:
Compress wp-content/uploads/ as uploads.tar.gz
sudo tar -C /var/www/wordpress/wp-content/uploads -zcvf uploads.tar.gz .
Check the site ID number M from Source WP Host – Settings – Domain.
Compress wp-content/uploads/sites/M as uploads.tar.gz
sudo tar -C /var/www/wordpress/wp-content/uploads/sites/M -zcvf uploads.tar.gz .Transfer the file to Target WP Host
scp uploads.tar.gz targetusername@targetIP:folder
scp uploads.tar.gz email@example.com:.
The file will be transferred to michelle home directory.
scp -v -P 22222 uploads.tar.gz firstname.lastname@example.org:.
-P portnumber: If SSH port already move from 22 to portnumber
-v: verbose, to check for error
Remove the upload.tar.gz file afterward (reduce security risk):
- Copy Source WP Host database to a temporary
Export Source WP Host Database: wordpress
Create new temporary database on Target WP Host: tempdb
Import Source WP Host Database to tempdb on Target WP HostTo migrate single site from multi-site, only Export the site tables to tempdb on Target WP Host. Check the site ID number N from Source WP Host – Settings – Domain, and the tables are using that number in its prefix: wp_N_tablename.
Or if migrating using full backup database, delete other site table after importing to the tempdb on Target WP Host.
- Replace domain name on tables contents
Download dbmaster tool.
Unzip dbmaster tool on Target WP Host webroot.
Using dbmaster tool, on tempdb, search and replace from HTTP or HTTPS://sourcedomain.com to HTTP or HTTPS://targetdomain.com.
Delete dbmaster tool from webroot (reduce security risk).
- Make sure the admin email is correct on wp_options
- Delete site tables on Target WP Host database
- Import site tables from tempdb to Target WP Host database
- Restore the Source WP Host files on Target WP Hostsudo tar -xvzf uploads.tar.gz -C /var/www/wordpress/wp-content/uploads
Or for site ID N on multi-site:
sudo tar -xvzf uploads.tar.gz -C /var/www/wordpress/wp-content/uploads/sites/NRepair /uploads file privileges:
sudo chmod -R 755 /var/www/wordpress/wp-content/uploads
sudo chown -R www-data:www-data /var/www/wordpress/wp-content/uploads
Remove the uploads.tar.gz (reduce security risk):
- Test the migrated new site
Turn on Maintenance on the new site.
- Delete the tempdb
- Finalize migration
Turn on Maintenance on Source Host, turn off Maintenance on Target Host.
- Check and test the new site
HTTPS Sub-Site Same Domain Host Migration
The aim of these procedure is to make sure that the new site will have all contents of the old site, while minimizing down time of the domain.
- Create New Site on the New Host https://domain.com.
- If needed, set the Original Site on the Old Host to Maintenance Mode On.
- Direct http://domain.com DNS A Record from Old Host IP to the New Host IP. Offline time starts. The domain.com will then resolved to New Host non SSL web server.
- Copy latest sub-site database tables, and change the table prefix to New Host using local network IP.
- Copy latest sub-site /uploads folder to New Host using local network IP.
- Extend domain.com on New Host SSL, and register as SSL server on the conf file.
- Check Nginx configuration and reload Nginx. The https://domain.com will be served from the New Host. Offline time ends here.
- Turn Maintenance Mode Off on the New Host if its On.
- Test the https://domain.com on New Host.
- Use script to:
- Copy the latest sub-site database tables
- Change the table prefix
- Export and compress the SQL file
- Send the file from Old Host to New Host
- Import SQL on New Host database
- Compress /uploads/M folder, send compressed /uploads folder to New Host, and move to the /uploads/N on New Host
- Use DNS server that have fast A Record change response time.