2015 EDIT: This applies only if you’ve moved your WordPress installation from one folder in your system to another. If you’re actually migrating to another host (like from your own installation at WordPress.org to a managed installation at WordPress.com ) use the export and import feature instead. I’ll write about troubleshooting that in a new post, but you can also find info here and here.
This advice applies to individual WordPress.org installations that have been moved to a different directory on the server. In my case, I had moved my WordPress.org installation out of the “ideablog” directory and into my web root. It’s really just a simple MySQL Find and Replace, but here you go.
A few days after moving this blog to a different folder, I realized all of my older posts had broken images. Luckily, the fix was a relatively easy find-and-replace in my favorite little MySQL client. Or even my unfavorite client. I used phpMyAdmin, and after making a backup of my database, it went something like this:
UPDATE `wp_posts` SET post_content = REPLACE( post_content, 'yoursite.com/OLDFOLDER/', 'yoursite.com/NEWFOLDER/' )
So, for example, if you blog was at cute.net/nyan and you’ve moved it to cute.net/ponycorns, and now you want to fix the broken image links, you would back up your database and run a query like this:
UPDATE `wp_posts` SET post_content = REPLACE( post_content, 'cute.net/nyan/', 'cute.net/ponycorns/' )
It’s just important to be sure to use enough of the old url that you’ll avoid replacing the wrong things. You wouldn’t want to replace ALL instances of the word nyan with ponycorn, right?
I hope that helps!
Velda – too bad I live in London and can’t buy you lunch! 🙂
Ah, these days I couldn’t accept lunch anyway – I don’t do anything like contract work anymore. But if you’re having trouble, let me know!
LikeLiked by 1 person
I ran the query and I still cannot see the images. My site is live from http://www.ongwediva.com.na/www to http://www.ongwediva.com.na
Please let me know.