Some images not found 404 in localhost

I just transferred a WordPress installation from the domain to my localhost. I did all the usual steps: copy files, export DB and replace domain.com with localhost, update wp-config.php and refresh permalinks. All pages and custom rewrite rules work, but some images are giving a 404.

When I check those images on the actual domain it all works fine, but something doesn’t look right; if I check the url of the image it points to this path:

Read More
http://domain.com/wp-content/uploads/2013/08/IMG_0425-185x185.jpg

But this file doesn’t exist! I looked in the uploads folder through FTP and the file isn’t there, only IMG_0425-185x185-150x150.jpg exists. Note that 185x185 is part of the original filename but 150x150 is added by WP.

In localhost the image doesn’t show up (404), which makes sense.

Why is the image showing up on the domain when it doesn’t even exist? Is WordPress resolving the image to the generated thumbnail somehow? Why isn’t it working on the localhost if this is the case?

Edit:

This is what makes no sense. How is this possible? Maybe the cache has something to do?
As you can see no trace of IMG_0425-185x185.jpg in the folder (??) but IMG_0425-185x185-150x150.jpg exists.

enter image description here

Related posts

3 comments

  1. Changing the home and siteurl in your wp_options table is not enough unfortunately. You will still have your post content with your non-localhost URL (http://domain.com) causing your website to not display properly on your localhost.

    Once you’ve downloaded and imported your database to your localhost. Follow these steps:

    1. Go and download Interconnect IT’s Database Search & Replace Script here
    2. Unzip the file and drop the folder in your localhost where your WordPress is installed (the root) and rename the folder to replace (screenshot)
    3. Navigate to the new folder you created in your browser (ex: http://localhost/wordpress/replace) and you will see the search/replace tool
    4. It should be pretty self-explanatory up to this point: enter your old URL in the search for… field and the new URL in the replace with… field

    You can click the dry run button under actions to see what it will be replacing before you execute the script. Once you’re done be sure to remove the /replace/ folder.

  2. If it’s not there in your FTP client – therefore not on your server – it’s not going to be showing up on your site. So it’s almost certainly a caching thing in your browser, have you tried clearing it or doing a hard refresh? WordPress’s rewrite won’t fallback to the thumbnail if the original image isn’t there. the .htaccess will just load up the index.php which will throw a 404.

    The other thing I would check is to make sure the URL is pointed to where you think it’s pointed. WordPress stores all it’s image links as an absolute URL in the DB. And unless you do a find+replace when you transfer a site, that won’t get updated. You said you were moving the site around and it’s quite possible you’re actually loading the image from an older server.

Comments are closed.