Themergency fooplugins

Migrating Your WordPress Site To A New URL


There have been many posts on this subject and there are lots of plugins to help you do this. I personally use Backup Buddy to migrate sites, especially if I want to migrate a site in or out of a multisite install (check out my previous walk through on how to do this).

But sometimes you do not want to go through the hassle of installing plugins. Maybe you just want to login to your web server, zip up your WordPress folder, script your entire DB and do it all manually. If you know how, this can be a really simple process.

Or perhaps you just want to change the URL of your site - you want to keep it hosted on the same server, but you just want to change the url, for example, from to .

These are the SQL commands I run to make this change:
/* update all post permalinks */
update wp_posts
set guid = REPLACE(guid, '', '')
where guid LIKE '%';

/* update all post content */
update wp_posts
SET post_content = REPLACE(post_content, '', '')
where post_content LIKE '%';

/* update all post meta */
update wp_postmeta
SET meta_value = REPLACE(meta_value, '', '')
where meta_value LIKE '%';

/* update all options */
update wp_options
set option_value = REPLACE(option_value, '', '')
where option_value LIKE '%';

Obviously, this will change from site to site and it depends on the table prefix your WordPress install is using and the urls.

So I created the WordPress Site URL Migration Generator to help you generate the SQL code really, really quickly. Just plug in the old url, the new url and your WordPress table name prefix. Check it out and let me know if there is anything missing or incorrect. Or drop me a line if it helped you in any way.

  • Get Livefyre
  • FAQ

In my experience of migrating over 400 the easiest is an export of the Dbase using phpmyadmin and copy wp-content


wow its pretty cool actually. Tnx mate.....

themergency moderator

cool thanks for the link Adam :)


This is super useful, thanks for creating it.


One potential "gotcha" to watch out for is the use of serialized arrays by some plugins. Changing the url to one with a different number of characters can cause havoc. This is a script I've used in the past with success (before BackupBuddy accounted for serialization).