Migrating WordPress

There are different ways to migrate a WordPress website.  Installing some free plugins can make this task a simple operation for the intermediate WordPress user.  There are some pitfalls that can cost you a lot of time and headache.  This is step by step guide is one I have used to move a WordPress website from one server to another.

  • Backup your whole site:
    •   This includes the database. Make sure you have your site backed up.
  • Install a migration plugin:
  • Export you website.
    • The All in One WP Migration tool has an export feature. This will create a file you can download.
  • Export Theme Settings in Theme options if available:
    • Proper website customizations utilize a child theme.  If the customization are contained in the themes custom CSS export that data.  Each Theme is different some have export settings features and some don’t.  You will want to export these settings just in case the Theme setting do not transfer completely.  If your Theme is improperly coded Theme settings and customizations can be lost so it is important to back these settings up separately.
  • Install the Latest Version of WordPress:
    • On the server you are moving the website too make sure there is an updated WordPress installed.
  • Install the Migration Plugin:
    • Install the All in One WP Migration plugin on the new site.
  • Import the site:
    • Use the import feature to upload the file you had previously exported to the new server.
  • Import Theme Settings:
    • Import your Theme settings.  This is different for every Theme.  Check with the Themes creator.
  • Test everything:
    •  Test Contact Forms
    • If the new sites URL is different than the old site.  Any image urls that are not relative paths with have to be corrected.  The plugin Search and Replace can search the database for the old URL and change all the occurrences to the new URL. This is a dangerous operation so make sure you know what you are doing and back everything up before making any changes.

When building a website it is important to take into consideration the difference between relative paths and absolute paths.  You should build your website using relative paths for image urls and links.  If you do not use relative paths, moving your site will cause these links to no longer work.  Each link will have to be corrected using the new domain name or better yet, made into a relative link.  This occurs often when a subdomain is used as the development environment.

If you are not the original site creator and you have inherited a site that has used absolute urls.  You may want to consider using a plugin like Better Search and Replace.  This plugin is very powerful and can render your site inoperable if you search and replace the wrong things.  Make absolutely sure you know what you are doing and BACK UP you site.

If you simply copy all the files from one server to the other without using a plugin to export the site you will have problems with your site. Themes and Plugins utilize the built in WordPress API to store their customization settings.  This API uses a serialized array to store these values.  The challenge with a serialized array is to change the data in it (like the domain name) you must un-serialize it, change the data, then re-serialize the data or the data will be corrupted.  For many Themes if they are unable to read their settings and customizations they will revert to the default settings.  This will cause all of your changes to be lost.  Remember your backup? Did you export the Theme settings?

As I mentioned before there are several plugins that will handle this for you.  A lack of sufficient server memory can cause the migration to halt.  This can be overcome by making sure your hosting account has more than one gig of memory available.  That is usually enough to migrate a small to medium sized website.

On the destination site, choose the import selection in the All In One Migration plugin settings and import the zip file you downloaded from the original site.  After clicking the import button it will start to upload.

When it is done uploading you will be prompted with a warning saying you will lose the current database and site.  Click ‘ok’ (because it is just a default WordPress install) and it will begin installing the site.  This can take some time so be patient.

When it finishes save your permalinks twice.  This will ensure that the migration has set the correct permalinks in the database.

Changing the DNS records to point to the new server is the final step and has its own pitfalls.  Changing the Nameserver domains can cause email accounts to stop working if they are hosted on the old server. By changing the A records only you are able to continue using your old email server but your domain will be pointed to your new server.  So make sure you have your email situation taken care of before you change the DNS settings.  This change takes some time to take effect so in the mean time you can look for errors on the new site.  You may have to view it through the ip address or by using a Tor browser.

It can take up to 24 hours for the DNS changes to take effect so be patient.  DNS records are stored in your browser as well so it may help to clear your DNS cache in your browser and computer.

If you are able to view your site look for broken images and links that don’t work. Test all contact forms etc.  Sometimes contact forms will continue to use the old domain ( http://subdomain.domain.com ).  If it was a sub-domain than the email will no longer get sent to you.  So you will want to make sure these settings have been changed.

If you are lucky everything should work fine. If not you will have to begin to trouble shoot the problems.

  • Broken Image Links.
  • Funny symbols instead of icons.
  • Images still served from the subdomain.

Good luck!

These directions are slightly different if you are going from a development subdomain to a live domain (same server).  More on that in another post.

FYI – I now use a different method involving the command line almost exclusively. It is not for the average user.

~ Layer7web

Leave a Reply