Have you ever had to migrate a blog from one URL to another? Yeah, you and me both – 1,000 times it seems.
For those that have the development chops this process is boring and well-worn but for many this is a scary proposition and you end up spending a lot of time on Google to look for solutions.
Perhaps if all you’re looking to do is change the Site URL is use this neat generator that’s freely available? Check it out:
Here it’ll just spit out the MySQL code that you’ll need to execute against to make that Old URL into the New URL.
Easy and simple – as you can see, if I were to change the blog URL from https://torquemag.io to http://blog.wpdaily.co (moving to a subdomain) then I could easily put this into phpMyAdmin:
[code]
/* update all post permalinks */
update wp_posts
set guid = REPLACE(guid, ‘https://torquemag.io’, ‘http://blog.wpdaily.co’)
where guid LIKE ‘%https://torquemag.io%’;
/* update all post content */
update wp_posts
SET post_content = REPLACE(post_content, ‘https://torquemag.io’, ‘http://blog.wpdaily.co’)
where post_content LIKE ‘%https://torquemag.io%’;
/* update all post meta */
update wp_postmeta
SET meta_value = REPLACE(meta_value, ‘https://torquemag.io’, ‘http://blog.wpdaily.co’)
where meta_value LIKE ‘%https://torquemag.io%’;
/* update all options */
update wp_options
set option_value = REPLACE(option_value, ‘https://torquemag.io’, ‘http://blog.wpdaily.co’)
where option_value LIKE ‘%https://torquemag.io%’;
[/code]
Thanks to Themergency for the generator!
4 Comments