Cranes

Move Your WordPress Site to New Server

There are many cases where you might need to move or copy your WordPress site to a new server. You might be working on it on your local computer, and you now want to move it to a hosted server to make it live. Or, the opposite: you have a site that is live, and you want to move it to your localhost. Or, you might just be changing hosts. It’s a common thing to want to do, and it’s surprisingly difficult if you don’t know the trick!

I spent literally hours searching on the web for how to do it. There are no shortage of ideas. It’s especially painful if the URL of the site is changing (for example, from http://yoursite.com to http://localhost/yoursite.com) because you have to modify the WordPress database. The WordPress Codex describes a fourteen-step process (actually, some of those have sub-steps, so it’s really more!). If you screw it up, you could corrupt your site!

The Solution If Your URL Is Changing

I don’t know why more people don’t know about this secret, but there is an AWESOME free plug-in that does the move in three easy steps. It is called Duplicator:
http://wordpress.org/extend/plugins/duplicator/

Check out this video to see how easy it is:

[youtube http://www.youtube.com/watch?v=nyHNV6D2w2c]

My colleague found this plug-in. I tried it after struggling for hours using other techniques. It worked with no problems. If you don’t believe me, just look at the ratings on the site.

As an added bonus, this method automatically gives you a nice backup of your WordPress site, which is always a good idea. If you just backup your database through phpmyadmin or other method, you save the data but lose all of your WordPress settings. This preserves an exact copy of everything about your WordPress site verbatim, including posts, data, settings, widgets, etc!!

Some Tricks to Remember

Before moving your site, you’ll need to create a “package” and installer file at your existing site. Copy these to your new server, then run the installer file. It will give you a form to fill out.

At this point, you’ll need to create a MySQL database at the destination. If you’re moving the site to your computer, then the database location is “localhost”. If you’re moving it to a live server, then you’ll have to go to your hosting control panel to find the location of the server. In GoDaddy, there is a “MySQL” button in the hosting control center.

Once this is done, fill in the form with your database login info and start the migration!

I encountered an issue where I would be re-directed to the old site whenever I tried to get into the admin panel of the new site. Apparently this is a common problem from what I’ve read on the Internet. The solution is to go into phpmyadmin and look for occurrence of your old URL in the database. There are only two occurrences in a single file (the one that corresponds to the Settings panel in the admin section). Change these to your new URL and you should be fine.

Finally, check the images on your new site to make sure they are pointing to the new URL and not still pointing to the old one. I had to manually change the image paths when I did the migration.

In spite of these little issues, I can’t recommend this plug-in enough!!! It is a must-have in my book, even if just for the backup capabilities.

If Your URL is Not Changing

The above tricks and plugin are suitable when the URL of your site is changing.  If the URL is not changing (for example, if you are moving your site to a new server for performance reasons), then you can simply copy the files and MySQL database to the new server and update your wp-config.php with the new database path.

Some themes have some quirky behavior when you move them, so minor adjustments might be necessary. For example, if you are using a Thesis them, you might have to “re-activate” the theme in the admin panel.

Let me know what you think! – Brian


Leave a Comment or Ask a Question