• When I moved my WP site to a different server, all the uploaded images went missing. The data is there, but the images are not loading. I looked into the database and found that all the uploaded images are given a full system path in the postmeta table. For each image, you have 2 rows. One row with the key of “_wp_attached_file” looks like this:

    /home/12345/domains/mydomain.com/html/wp-content/uploads/2008/03/photo.jpg

    This one is no big deal since I could just run search and replace and fix them all. But the other row with the key of “_wp_attachment_metadata” is a real problem. This contains a long string, and the part of it looks like this:

    s:78:"/home/12345/domains/mydomain.com/html/wp-content/uploads/2008/03/photo.jpg"

    The problem is the first part “s:78”. The number corresponds to the number of characters used in the path to the image file. I have no idea why this parameter was necessary at all, but this makes it impossible to do search and replace, unless the new path happens to use the same exact number of characters.

    If you only have a few images, this isn’t a big deal, but what if you have hundreds of images? This would make it impossible to move the site anywhere.

    Has anyone come across this problem? Can anyone suggest a solution for this?

  • The topic ‘Image path problem when moving the site’ is closed to new replies.