Migrating WordPress to a new URL

WordPress is a nonsense, and stores it’s URL in multiple places in the database. If you want to move your WordPress install to a different host, exec the following MySQL commands to change the URL in all instances:

UPDATE wp_options 
   SET option_value = REPLACE(option_value, "[Old site URL]", "[New site URL]")
 WHERE option_value LIKE "%[Old site URL]%";
 
 UPDATE wp_posts 
   SET post_content = REPLACE(post_content, "[Old site URL]", "[New site URL]")
 WHERE post_content LIKE "%[Old site URL]%";
 
  UPDATE wp_posts 
   SET guid = REPLACE(guid, "[Old site URL]", "[New site URL]")
 WHERE guid LIKE "%[Old site URL]%";

   UPDATE wp_postmeta
   SET meta_value = REPLACE(meta_value, "[Old site URL]", "[New site URL]")
 WHERE meta_value LIKE "%[Old site URL]%";

Replace [Old site URL] and [New site URL] appropriately

Use this form to generate the SQL for YOUR database

2,909 thoughts on “Migrating WordPress to a new URL

  1. Today, while I was at work, my sister stole my iphone and tested to see if it can survive a 25 foot drop, just so she can be a youtube sensation. My iPad is now broken and she has 83 views. I know this is entirely off topic but I had to share it with someone!

  2. My family members always say that I am wasting my time here at web, however I know I am getting experience all the time by reading such nice articles or reviews.

  3. It is the best time to make some plans for the future and it is time to be happy.
    I’ve read this post and if I could I want to suggest you some interesting
    things or tips. Maybe you can write next articles referring
    to this article. I desire to read more things about it!

    my website – four winds online casino

  4. Awesome blog! what is gambling debt (Newton) your theme
    custom made or did you download it from somewhere? A theme
    like yours with a few simple tweeks would really make my blog stand out.
    Please let me know where you got your theme.
    Kudos

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>