I have recently migrated a wordpress website and come across some issues with broken links.
I move images in one folder to a deeper link in my site using ftp.
Old image path: http://orayans.com/articles/images/abc.jpg
New image path: http://orayans.com/wp-content/uploads/articles/abc.jpg
If you have hundreds or thousands of post in your site, it will take heaps of time to open each wordpress page/post, edit the link and save them one by one. Therefor the simple solution is to run a script in back end to update sql database via php myadmin. Normally your word press posts are stored in ‘wp_post‘ table under ‘post_content‘ field (This wp_ prefix can be different from wp installation to installation). The main problem here is to update live database with a script to only affect a certain chunk of data in it. How to update urls or content in a wordpress posts or pages as a bulk using mysql database script? here is the solution…
UPDATE wp_posts SET post_content = REPLACE (post_content, “http://orayans.com/articles/images/abc.jpg”, “http://orayans.com/wp-content/uploads/articles/abc.jpg”);
In the above example http://orayans.com/articles/images/abc.jpg is my old URL and http://orayans.com/wp-content/uploads/articles/abc.jpg is my new url. ans the script will will replace all occurrences of content in first quotations by the content in second quotations, site wide.
you can use the dame script to update any text withing the pages/post.
example: UPDATE wp_posts SET post_content = REPLACE (post_content, “I am happy”, “i am sad”);
Anyway never forget to make a backup before manipulating any database 😉