The Problem

Every time I move a WordPress website to a new domain name or url (eg: moving it from a testing site to a live site) I can always count on one thing; my ability to forget the SQL statements to update the urls.

My problem isn’t so much forgetting that I have to do it, but actually forgetting the code itself. Even worse, I haven’t actually documented the code anywhere so I can’t just copy and paste it from somewhere else.

The 3 lines of code really aren’t much to remember, I mean, they are simple and very logical. It’s virtually a find and replace of the old urls to the new urls but for some reason everytime I need it my head just goes blank. Sure I could probably do a find and replace in the SQL dump of the database before the import, but in the past I have faced issues doing it this way for some reason.

For future reference, here is the code:

UPDATE wp_options SET option_value = replace(option_value, 'THEOLDURL', 'THENEWURL') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'THEOLDURL','THENEWURL');

UPDATE wp_posts SET post_content = replace(post_content, 'THEOLDURL', 'THENEWURL');

I actually did something about it

It happened again the other day and I’m tired of it, so I decided to do something about it. No, I didn’t memorise the code because well, lets face it, I really should know it already but for some reason it won’t stick. Instead I created a little website which will do it for me. Besides, I figured I can’t be the only person who makes this mistake, so why not help other people out too?

Welcome, Here you simply enter your current WordPress site url (eg: http://localhost) followed by the destination url (eg: and click the generate button. It then spits out the SQL code you need to run. Easy as pie.

But wait, there more!

Also, I figured I might as well provide some general instructions on how to manually move, backup or restore a WordPress website, so I added that too. It is all text right now, but I’ll hopefully clean it up, throw in some images and just make it nicer to read overall.

So that’s it, the next time you are migrating a WordPress website, head on over to Moving WordPress and shave that whole 5-10 minutes off your workload. I know I’ll be using it.


  1. Blue says:

    Hello! is one of the greatest finds I have ever had the pleasure of stumbling upon.
    Currently (as of Oct. 30, 2012) the site is down. Please, oh please tell me this is not so… This is a temporary issue with the website right?

    Thank you for everything you do!

    P.S. If these sad news are in fact true :(
    Could you please forward me the original ‘SQL Update’ and ‘Step By Step’ instructions you had listed on the site? Your instructions were the most comprehensive and direct set of WP moving literature I have ever seen and I would greatly appreciate having those directions.

    Thank you so so much!

    • Hey Blue,

      Thanks for your awesome comment and very kind words.

      The website is down because I let the domain name slip. I’ve now just renewed the domain name and it should be up and running again in no time.

      Thanks again for your support.

  2. Linda says:

    Genious! Bookmarked it of course, thank you!