scriptygoddess

14 Jun, 2008

Moving a WordPress Install

Posted by: Jennifer In: WordPress|WordPress Hacks

One of my clients recently purchased new servers and wanted to migrate all their sites to the new servers. Some of these sites were wordpress powered. Thankfully, I found this article that made the move a breeze.

The critical thing I want to save for my future reference is the following sql lines from that post:

UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');

See the post on My Digital Life for the full instructions :)

Updating to add… There's another SQL line that will be helpful if you have any custom fields that have direct paths to images or files on your old server…

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://www.old-domain.com', 'http://www.new-domain.com');

5 Responses to "Moving a WordPress Install"

1 | taiyo

June 20th, 2008 at 7:08 am

Avatar

I was a little worried the first time I had to migrate a wordpress site too. But like you said it's actually very easy.

I do it for my clients now all the time.

2 | Velvet Blues

October 4th, 2008 at 12:44 pm

Avatar

We just released a plugin which makes dealing with SQL unnecessary. And it does update both the permalinks and the links in post and page content.

Check it out at: http://www.velvetblues.com/web-development-blog/wordpress-plugin-update-urls/

3 | taiyo

October 21st, 2008 at 9:09 am

Avatar

@velvet
Awesome! thanks for sharing that.

For moving from one directory on a website to another one can just put a .htaccess redirect and that solves the old-links-in-posts problem. But for moving to a different url altogether your plugin is a lifesaver.

4 | hixster

February 4th, 2010 at 9:11 am

Avatar

Thanks for this! I searched high and low on WP and never found any mention of this at all.

After running the above SQL my migration works a treat!

Thanks again

5 | scriptygoddess » Blog Archive » The Blogger to WordPress move from hell!

May 21st, 2010 at 8:08 pm

Avatar

[…] way better than trying to chew through a 30MB import file. Once the database is up on your server, a few more SQL commands (just like if you're moving your blog to a new domain) to change the local version (probably http://localhost:8888 ) to your actual domain name, and […]

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements