How to migrate a WordPress site

FacebookTwitterGoogle+LinkedInDiggEmail

Because of the increasing popularity of WordPress, the question of how to migrate an existing WordPress site is one we receive frequently.  Several of our customer relations specialists have assisted in fine tuning a general process, and we thought we would share this set of instructions in the hopes that it will save you some frustration in attempting this task on your own.

This post assumes you have basic knowledge of navigating both the WordPress Dashboard, and the IX Web Hosting control panel.

Utilities you will need:

  • Either a search-and-replace tool, or an advanced plain-text file editor with a search/replace function (Windows Grep or Notepad++ recommended)
  • A compression utility with .gzip compression option (7-Zip recommended)
  • A ftp-client and the ftp information for your account (FileZilla recommended, ftp info can be found/changed inside your IX Control Panel under FTP Manger)

Inside of your WordPress Dashboard (aka wp-admin)

  • If your Permalinks settings are something other than “Default”, take note of this setting and change it to “Default”
  • Take note of your Widgets settings and locations as sometimes these are reset when moving your installation
  • Take note of any custom menu buttons for the same reason
  • Finally, take note of the Blog location and Home location settings inside of the General settings section.  You will need these.

Using a ftp client (such as Filezilla)

  • Copy all of your WordPress site’s files to your computer
  • After the copy is complete, copy it again so you will have a second backup just in case.  You will be modifying at least one copy of this backup, so creating another is recommended in case anything goes wrong
    • This can be done before changing the settings in the WordPress Dashboard but occassionally a plugin will rewrite a file based upon your Permalinks settings.  Therefore, I typically suggest doing this after making the Permalinks change.

Inside phpMyAdmin – Export

  • Launch phpMyAdmin from your IX Control panel using the mysql database username chosen when your WordPress installation was created
    • If you do not know your database username, you may find it inside of your wp-config.php file
  • Once inside of phpMyAdmin, click on (or choose from a dropbox) the WordPress database name on the left side of the screen
    • Again, check your wp-config.php file if unsure what your database name is
  • You should now see, on the main section on the right side of the screen, a list of your database’s tables.  These usually start with the prefix “wp_” but another prefix also could have been specified during the WordPress installation.
  • Click on the Export tab at the top of the screen.
  • Without changing any options, click the Go button at the bottom of the screen.  This will start the database copy process and may either ask you to download a file ending in the extension “sql” or may even open this file in your browser automatically.  If your browser automatically opens this file, wait for the page to fully load, then save the file to your computer from your browser’s menus.
  • Just as with the files you downloaded via ftp, make a 2nd copy of this file just in case

Congratulations – 1/3 there

If you’ve made it this far, you have a truly FULL backup of your WordPress site.  If anything ever happens to your WordPress site, you can use these files to overwrite and restore it to today’s exact settings and content.

Prepare your database backup for migration

  • Your database backup “sql” file contains information specific to your old blog.  You need to search and replace that information to the new blog location.  To do this, you can either use a program such as Windows Grep, or open the file with a PLAIN-TEXT editor.  Notice the emphasis on PLAIN-TEXT… do NOT use office document editors as they may alter the contents of this file, or not load at all because of the sheer size of this file.  I recommend using Notepad++ or Dreamweaver if you have them… Notepad++ is free, lightweight, and easy to use, and Dreamweaver is a common favorite of developers (and a free trial is available if you don’t own your own copy).  Windows Grep will do this process much easier and faster, especially on older computers, since it doesn’t attempt to load the entire file into memory at one time.
  • Once you have either of these, look for a “Find and Replace” or just “Replace…” option in the menus.  You will need to search/replace both the Blog location and Home location you made note of earlier (these may be the same, if so, only one search/replace is necessary) and of course you are replacing with the new locations you intend to use.
    EXAMPLE: Search For: olddomain.com  Replace With:  newdomain.com
    • If either the new or old WordPress location involve a subfolder… be sure to type this in in the following format “mydomain.com/foldername”
    • As I hinted at in the description of this section, this file may be HUGE!  Depending on the speed and power of your computer, you may be waiting a while for it to open the file, and even longer still for it to replace everything.  If you have a really old or low performance computer, you may not be able to complete this part… but one of our customer relations specials can attempt to do so for you
  • Once the replacement is complete, save this file (as a new name if you’d like so can easily distinguish it from your backup copies)

Prepare your file backup for migration

  • Just as you searched and replaced your database backup, you should also search and replace every file in your file backups as well.  Don’t worry, you shouldn’t have to do this individually with each file – all three of the programs I recommended have a search and replace option for an entire directory at a time.
    • Find this option to search multiple files/directories and, just like above, search for your old WordPress location, and replace with your new WordPress location

Create a new database for the new location(s)

  • This will not be necessary if you intend on re-purposing the same database you were using before, but will be necessary if you are changing accounts, changing hosts, or keeping the previous WordPress location active
    • Click on MySQL Server inside your IX Control Panel and follow the steps to create a new database, a NEW user (for both security and performance reasons, do not re-use the same user), and a new password.
  • When creating your database, you will have the option to specify a description – I always recommend writing the name of the domain (or domain+folder), your chosen “name” for the blog, or another unique identifier so you can easily know what this database is used for
  • The password will need to contain, at minimum, one uppercase letter, one lowercase letter, and one number
  • Make note of the following 4 things as you are going through this process… you will need them:
    • Database Host (mysql####.ixwebhosting.com for example)
    • Database Name
    • Database User
    • Database User Password

Update wp-config.php

  • This will not be necessary if you intend on re-purposing the same database you were using before, but will be necessary if you are changing accounts, changing hosts, or keeping the previous WordPress location active
    • Almost done with the modifications now… this one is easy.  Find the copy of the wp-config.php file you copied via ftp earlier and open it in your plain-text editor.  Now, find and update the Database Host, Name, User, and Password with the ones you noted earlier when you created your new empty database.  There are literally only four lines here and they’re at the top of the file so you won’t need any search/replace tool… just make sure that all 4 options retain the quotes that were surrounding them before you started.

Compress your modified database file

Unfortunately, while phpMyAdmin will generally export large database files, due to the load importing a large file can generate, phpMyAdmin has been limited to only import a file as large as 2MB.  This means that the file you just modified is probably too large for phpMyAdmin to accept.  The GOOD news is that phpMyAdmin will accept archived files.

  • Using the compression utility of your choice, create an archive out of the file you just finished modifying and choose GZIP as the format (again, 7-Zip is recommended here because it’s free and fairly easy to use)
    • Some versions of phpMyAdmin do accept ZIP (.zip) files, but all versions accept GZIP (.gz) files so of course I recommend you choose this format

Ready to migrate

Alright, in theory you now have a copy of WordPress ready for uploading to your new blog location.  Because you have a full backup of your database and files, you will not need to install WordPress first in this new location, and will simply put them into place.

  • Using your ftp-client, connect to the location of the new blog, and upload all of the WordPress files you copied down earlier (and the modified wp-config.php file of course)
  • Using phpMyAdmin, go through the same steps you did to Export, only this time choose the NEW User, and choose the Import tab.
    • If given an option to “continue on errors” on this import page, check this option
  • Click on the Browse button and find the GZIP file you created with your modified database backup, and click Go

Cross your fingers

Now your WordPress installation should be fully migrated, and is often mostly if not fully functional.  Try to browse to your new WordPress location and if it displays, click on a few links to make sure everything works properly.  If it does NOT work correctly, or doesn’t load… continue with these steps:

  • Log into your new location’s Dashboard
  • Check the General settings tab to make sure the Blog and Home locations are correct (if not, there may have been a mistake in your search/replace)
  • Check your Permalinks settings and make sure they are set to Default (for now)
  • If either of these were changed… try your blog again.  If still not working correctly, go back to your Dashboard again…
  • Set your theme back to the default WordPress theme
  • Disable (you shouldn’t need to uninstall) your plugins
  • After saving all of these changes… go test your blog again.  It will probably work but won’t look anything like you want.
  • Re-enable your theme
  • Re-enable your plugins one-by-one
  • Change your Permalinks back to the way you had them before

* If your WordPress site is STILL not working correctly… there may have been a problem with one of the steps above, or there could be factors outside of the norm (such as an oddly coded plugin, too low of PHP memory_limit, etc).  At this point, we can try to troubleshoot what the problem is, but depending on what the issue is… we unfortunately cannot guarantee success.  WordPress is a third-party application and has third-party plugins and themes.  As we are not developers, and are not the creators of either WordPress or your theme or plugins, we may not be able to fix the move… however we will be happy to take a look and try.  At the worst case scenario, we do have a development team who can offer you a quote to either fix, move from scratch, or remake your WordPress blog at it’s new location.

Thank you for reading this rather lengthy tutorial.  I sincerely hope it is of use to you, and of course if you find anything incorrect or that can be improved, please be sure to let me know.

FacebookTwitterGoogle+LinkedInDiggEmail

We're Always There When You Need Us The Most!

Your Dedicated Support

At IX, we take care of our customers. And dedicated support is one of the ways we prove to you again and again that we are here to help you every step of the way, regardless of your skill level. With IX dedicated support, you get a support technician personally assigned to assist you. You get their name, number, email, social media connections, and work schedule! It's just one more facet of our service which proves our deeply rooted belief that being a great hosting provider requires more than just cutting-edge technologies, but the best in support and service.