Moving a WordPress Install from one Domain (A) to another Domain (B)
From time to time I had have to move one installation of WordPress from one domain (let’s call it domain A) to a new domain (let’s call it domain B). Because WordPress embeds the domain all over the data schema (not faulting; simply disclosing) you have to make a lot of dB changes for the updated site location to function. Here is the quick and dirty way to move the data:
1
2
3
4
UPDATE wp_posts SET post_content = REPLACE(post_content,"[OLD_DOMAIN]","[NEW_DOMAIN]");
UPDATE wp_posts SET guid = REPLACE(guid,"[OLD_DOMAIN]","[NEW_DOMAIN]");
UPDATE wp_options SET option_value = REPLACE(option_value,"[OLD_DOMAIN]","[NEW_DOMAIN]");
UPDATE wp_postmeta SET meta_value = REPLACE(meta_value,"[OLD_DOMAIN]","[NEW_DOMAIN]");
Finally, for the final bit of trickery if you are using Advanced Caching on the site there is a great place where the localized PATH is hard coded. Edit your new and updated path on file advanced-cache.php
1
vi wp-content/advanced-cache.php
This post is licensed under CC BY 4.0 by the author.