Migrating from WP Engine to Kinsta

Moving WordPress sites between host providers is a fairly straightforward process. You generate a backup, import the backup, and reconfigure DNS to the new provider. With that said, doing it manually can take up a lot of time as there are lots of small steps in-between. The following is a collection of my own processes for moving a WordPress site from WP Engine to Kinsta. With these steps I can do a complete migration in about 10 minutes. That includes some particular large sites, as the file transfers happen directly between servers.

Go to https://my.kinsta.com/sites and select add site.


Next upload an SSH key to enable a password-free SSH for the new Kinsta account.

cat ~/.ssh/id_rsa.pub | ssh user@XXX.XXX.XXX.XXX -p XXXXX 'cat >> .ssh/authorized_keys'

Next, SSH login into kinsta ssh user@XXX.XXX.XXX.XXX -p XXXXX and paste the following block of script into the command line. The script will ask for three things: Kinsta database name, Kinsta database password, and WP Engine backup snapshot. On the WP Engine panel make a snapshot and download. Copy the Amazon S3 snapshot link from email and paste when prompted.

function anchor_prep {
 mkdir ~/scripts
 read -p $'\e[31mDatabase name\e[0m: ' dbname
 read -p $'\e[31mDatabase password\e[0m: ' dbpw
 echo -e "dbpw=$dbpw\ndbuser=$dbname\ndbname=$dbname\nmysqldump --user=\$dbuser --password=\$dbpw --no-create-db --databases \$dbname > ~/public/wp-content/mysql.sql" > ~/scripts/db_backup.sh
 chmod +x ~/scripts/db_backup.sh
 mkdir ~/downloads
 cd ~/downloads
 read -p $'\e[31mWP Engine download link\e[0m: ' downloadlink
 wget $downloadlink
 filename=`ls site-*`
 unzip $filename
 rm -f $filename
 rm -rf ~/public/wp-content/ # Removes current wp-content
 mv ~/downloads/wp-content/ ~/public/wp-content/ # Restore wp-content from snapshot
 rm -rf ~/public/wp-content/mu-plugins
 rm -f ~/public/wp-content/advanced-cache.php
 rm -f ~/public/wp-content/object-cache.php
 cd ~/public/
 find . -type d -exec chmod 755 {} \;
 find . -type f -exec chmod 644 {} \;
 chmod 600 ~/public/wp-content/mysql.sql


This will prep the Kinsta site by creating a new script for running database backups, downloading the WP Engine snapshot, removing a few WP Engine specific things and resetting permissions. There are a few other things to take care of before going live.

  • Add domain mappings in Kinsta.
  • Install and activate a coming soon plugin on WP Engine.
  • Flush WP Engine cache. This will prevent any changes while switching over.
  • On WP Engine, open PHPMyAdmin and export all tables with the drop tables option checked.
  • Upload your database backup to download folder and run the following:
mysql --user=$dbname --password=$dbpw $dbname < ~/downloads/wp_databasename.sql
cd ~/public/
wp search-replace https://anchor.host https://anchor.host --all-tables ## Turns off SSL
rm -rf ~/downloads
mkdir ~/downloads
  • Switch DNS to new Kinsta IP
  • Resync uploads directories incrementally using via Transmit
  • Apply new Let’s Encrypt SSLs within Kinsta and reapply https urls by running wp search-replace https://anchor.host https://anchor.host --all-tables ## Turns on SSL