I'm going to move my site from development/staging environment (i.e. dev.example.com) to production environment (example.com).

Probably, existing links in my pages and posts will still point to the old url, i.e. dev.example.com. how do i deal with this issue? is it possible correct all the links in one go? any suggestions?


2 Answers 2


See Moving WordPress « WordPress Codex

These are typical queries to run in phpmyadmin to change URLs, but you may also have serialized data in widget and theme options that will have to be changed, too:

UPDATE wp_options SET option_value = replace(option_value, 'http://olddomain.com', 'http://newdomain.com') WHERE option_name = 'home' OR option_name = 'siteurl';

UPDATE wp_posts SET guid = replace(guid, 'http://olddomain.com','http://newdomain.com');

UPDATE wp_posts SET post_content = replace(post_content, 'http://olddomain.com', 'http://newdomain.com');

UPDATE wp_postmeta SET meta_value = replace(meta_value, 'http://olddomain.com', 'http://newdomain.com');

And Search RegEx is a good plugin to be able to search and replace with Grep through all posts and pages to check if any URLs were missed.

  • Changing the GUID will cause feed readers to republish old content. The GUID is just an identifier for feed readers and is supposed to be unique. For most sites, its unnecessary to change it and for sites that have people subscribing to feeds its important not to.
    – Elpie
    Jun 7, 2011 at 13:01

What I do is make a dump of the database and then Search / Replace what I need either with a text editor if the DB is rather small (Geany is great for that) or if it's a big DB I use Regexxer Search Tool.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.