Migrating WordPress to another Server

Recently I was doing 2 Web migration projects with wordpress installations. The reason for the migration was in both cases performance issues, one was on a cheap shared host and had a super-sluggy admin interface, the other needed cutting edge performance for a better google rank (and better usability).

Both migrations followed these steps:

  1. Prepare
  2. Transfer
  3. Test
  4. Switch live

Prepare

Set up a Webroot on the new host

  • vhost / Subdomain config
  • ftp access
  • mysql Database (plus phpmyadmin)
  • SSH also helps.

Note all incredentials in a safe place alongside the IP/hostname.

If you want to be on the safe site, set up a blank WordPress installation just for seeing if everything works.

Transfer

  1. Tell authors: hands of the keyboard.
  2. Make a full file backup.
    While FTP is an ~o.k. method, I found that ftp transfers can break on big installations and miss some files.
    I recommend making a SSH connection and adding everything to a zip file. Then SSH to the new server and FTP the zip file from there, move to target folder and unzip. This way no file gets left behind.
    You might want to leave out cache and backup directories, to keep the file smaller. Cache is often in /wp-content/cache
  3. Make a full database export from the Database. Use sql and zip. Do not export the database name. The database name will be different on the new server.
  4. Import all files
    Check directory permissions, they should be 755 for directories and 644 for files. If you have problems uploading files or caching you might have to adjust those permissions (i.e. set wp-content to 775).
    Do not use 777.
  5. Import new Database
    If you do not change the URL, no need for touching the database. All users and urls will stay the same.
  6. Edit /wp-config.php on new server, change to new Database incredentials.

Test

I recommend doing the Test without touching the DNS entries, but instead edit your hosts file (as admin user), restart your browser and you should see the new server.

  1. go to /wp-admin, and clear all caches.
  2. Try to upload an image (to see if directory permissions are right).
  3. See if the front-end works. Especially try all forms, if they still send emails. (if you use such forms)
  4. Also take a look at the server if all files are there.

Switch live

First, use the old Namesservers and point to the new ip. It can take hours until all Nameservers get the update.

Remove the hosts file entry (or comment it with #). Restart your browser.

Use ping to see if DNS returns the new IP.

You can later transfer the Domain, make sure to move all DNS entries to all subdomains. Moving a domain also affects email services (MX-Entries).

Written by Ben