How to Migrate WordPress

Plug-in migration method

This relocation method is very versatile and is basically not restricted by external conditions such as hosting service providers. It has no technical requirements and the migration steps are simple:

  1. Install the migration plug-in on the old and new WP sites. UpdraftPlus is recommended.
  2. Use a plug-in to generate a remote backup, which can be a cloud storage service such as Dropbox , or your own SFTP server
  3. Restore from the same remote backup using the same migration plugin on the new site (with WordPress already installed)

There is more than one backup migration plug-in, such as All in One Migration, which is also commonly used, but the free version has limited support and is not suitable for migrating sites with backup file sizes larger than 512M.

Before backing up the new site, make sure the server has enough free hard disk space. When the domestic network connection is unstable, it is recommended to use your own SFTP to store backups, which can greatly speed up the migration. If you use a foreign service to store backups, the WordPress moving process will be repeatedly interrupted.

If the website backup file reaches GB level, it is not recommended to use this solution. It is recommended to directly use the WP CLI manual moving method below, which is more reliable.

WP CLI method

This relocation method is more versatile and suitable for WordPress websites of any size and hosting environment, but it requires manual operation through the server command line and has certain technical requirements. The migration steps are roughly as follows:

  1. SSH to log in to the old website server. If you log in with ROOT, you need to switch to a non-ROOT user who can read and write the website directory and files. Because ROOT cannot execute WP-CLI commands, it is not recommended to force WP-CLI to execute as ROOT.
  2. Export the database using wp db export
  3. Use the Linux tar command to package the entire website directory (including database backup files) into .tar.gz. When packaging, you can exclude non-essential files according to the specific conditions of the website, such as /wp-content/uploads/cache/*
  4. Upload .tar.gz to new server
  5. SSH to log in to the new website server, log in to mysql to create an empty database, write down the database name, user name and password, and update wp-config.php
  6. Switch to a non-ROOT user and import the database using wp db import
  7. Set up the web server and get the website online

In order to transfer backup files as quickly as possible, ensure that the old and new servers have reliable network links. If not, it is recommended to download the .tar.gz package to a relay server that can access the old and new servers at the same time.

When migrating a site with tens or hundreds of GB, you might as well use split to cut the large backup file into multiple files and then cooperate with rsync to resume the download to eliminate interruptions caused by various reasons.

Often when we decide to complete a WordPress move manually, there are more technical details than the above, and I offer moving services for complex WordPress sites .

Host snapshot method

This method is only suitable when the old and new servers of the website belong to the same hosting service provider. It will migrate the entire website host to a new host in a different computer room or with different hardware specifications. The steps are obvious:

  1. Shut down the site, freeze writing, and generate a snapshot for the current host in the hosting service provider panel
  2. Start a new host from a snapshot
  3. Complete other configuration changes, such as IP, DNS resolution, etc.
  4. New website online

Some hosting service providers support rebinding IP addresses to new hosts (called floating IPs or reserved IPs). If they do not support reserved IP addresses, you need to modify the DNS record to point to the new server IP.

The virtual host does not have a snapshot function, but it provides site-level “snapshot backup” and recovery. Please consult the service provider’s customer service.


Comments

Leave a Reply

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