I have an image that I've uploaded through the WP media library. I can see this image in my uploads folder via ssh/ftp. I cannot see this image if I put the URL in my browser, like www.site/files/image.jpg (It's a multisite and all uploads go into individual folders rather than be separated out by months).
In WP, the image shows as broken in the media library listing of uploaded files. Only when I select this image file and choose "edit image" does the image show up.
The 404 is not the regular WP 404 page template, it's a blank page that only says "404 — File not found."
And the best part is that this does not happen for all images/uploads.
Does anyone have any ideas I can take action on?
EDIT: It looks like any file with "pdf" in the file NAME (not file extension) is having this problem. .pdf files work fine. I don't know why the filename would make this happen...
I have an image that I've uploaded through the WP media library. I can see this image in my uploads folder via ssh/ftp. I cannot see this image if I put the URL in my browser, like www.site/files/image.jpg (It's a multisite and all uploads go into individual folders rather than be separated out by months).
In WP, the image shows as broken in the media library listing of uploaded files. Only when I select this image file and choose "edit image" does the image show up.
The 404 is not the regular WP 404 page template, it's a blank page that only says "404 — File not found."
And the best part is that this does not happen for all images/uploads.
Does anyone have any ideas I can take action on?
EDIT: It looks like any file with "pdf" in the file NAME (not file extension) is having this problem. .pdf files work fine. I don't know why the filename would make this happen...
Also happened to me, because of mod_expires.c
The rules were causing the 404, but the files were OK on FTP:
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif "access 1 week"
ExpiresByType image/jpg "access 1 week"
ExpiresByType image/jpeg "access 1 week"
ExpiresByType image/png "access 1 week"
</IfModule>
It turned out to be an .htaccess rule put in by a coworker. It was supposed to target just some .pdf files but the rule wasn't written strict enough.
So that was a fun few hours spent on wild goose chases.
I was getting this same exact issue because I had just moved the website to a new server+domain. I had updated the WP_HOME and WP_SITEURL in the wp-config.php but I guess that wasnt enough. The images were being uploaded to the new domain, but was being rendered to HTML with the old domain. I used did a search and replace in the database to permanently remove the old domain.
Had the same issue. Simply go to Settings -> Media and verify the structure of the directory for uploaded files, usually it has the previous route. Simply replace it with wp-content/uploads
and thats it.