I have been struggling with the most annoying problem for the last few months. I’d find that images on my blog would randomly be broken. Sometimes on a refresh it would be fine, and then BAM, no more image. I would try re-saving the image, re-saving the post, and sometimes it would work…and sometimes it would break something else.
What was so frustrating was that I knew that the images were still there on my server. I knew that the image locations and URLs hadn’t changed. So why were the images randomly becoming broken on my WordPress site?
After one morning where I was checking posts and re-saving the images, I decided to install a WordPress Broken Link Checker plugin. To no surprise, it didn’t find any image links that were broken.
With confirmation that it wasn’t an issue with the file, I dug deeper. My host, BlueHost, has had a lot of small bursts of downtime. Now they are a cheap host, but have been very helpful when I called. However, if I had any sort of high volume traffic on the blog I would most certainly change hosting providers. I searched to see if maybe BlueHost was known to have weird sporadic outages of just certain files. That ended up being a dead end (thankfully.)
I started searching various help forums and most were assisting people who had moved directories and so caused their own broken links, but finally, after searching for so long I stumbled on this thread. In it the contributor described my journey of trying to pin down a similar issue. He suggested that it was a corrupted .htaccess file. I hopped onto my file manager service, checked the option to “show hidden files”, and renamed the .htaccess file to htaccess.txt. I knew that WordPress will automatically create a .htaccess file if one is missing, so I went back to my site and tested.
Thankfully, this fix worked wonderfully and I haven’t seen any more broken images!
I am dealing with this same issue. I’m fairly new to wordpress and am finding this happening to a few of my blogs, and it’s so random! One blog in particular is very image heavy. When I post and check they are fine, and then I come back later, and there are random broken ones. So, I go to the directory of each blog and look for all hidden files, find .htaccess files and change them to hatches.txt? I’m worried I might f* things up more so need a little hand holding. Thanks in advance.
Hi Heidi!
First, lets see if its an easy fix. What plugins do you have running on your blogs? I actually had a 2nd issue which I detailed here, that was a conflict between Jetpacks “Photon” plug in with other CDN or Caching plugins. If you are running Photon in conjunction with those other plug ins, I’d suggest turning off Photon. Note, this will make more traffic come to your domain (as Photon puts your images on a wordpress domain for faster loading and less bandwidth on your site) so its a trade off. Or your other option is disabling all other CDN and Caching plug ins, and then turning them on one at a time and see if you can reproduce the error to narrow down which plugins are conflicting.
If that doesn’t work, then you may need to edit your .htaccess file. Anytime you are messing with files its good to use an external backup service. Thankfully I’ve only needed to use it once. (I use https://vaultpress.com/). Don’t run a search, because if you do have multiple domains you’ll have multiple versions of it. First, make sure your website is backed up. Instead you’ll need to be in your domain providers file manager, and make sure you are in the root folder for that domain (usually its a sub folder on your main account with the name of your domain). Make sure you have checked the option for “show hidden files” otherwise they won’t show up. I usually make a copy of my .htaccess file just in case. Then, because your computer cannot read a .htaccess file, I will rename it to something like htaccess.txt, this will then let you open the file to view its contents. Depending on your setup there might not be a lot here. For me it was mostly blank. I looked and copied anything that I thought I needed. Then because my domain provider automatically creates a .htaccess file, I closed everything out, went to my website to check and see if it was okay, and then went back into my file manager and checked to see if a new .htaccess file was created. If it did, I checked it against the old one, to see if anything is missing that I might need to manually copy over. For me, I didn’t need to copy anything else, so I was all set.
Which directory would I find it or them in?
You’ll have probably at least one in each domain that you own, in the root directory for that domain. So for mine, I look for a folder called liliontheloose.
I have 5 blogs and found about 20 .htaccess files. Which ones would I modify? Thanks fryer help. This has been driving me nuts.
Are you having the issue on all 5 blogs? I’d start with just one blog and work on a fix and once you have confirmed its working then repeat the steps on the other blogs.
You’ll have at least one .htaccess file for each blog. I’d recommend not running a search for that file name, as it will be next to impossible to know which domain they are for. Instead, look for your root directory for each different blog, usually a folder of the name of the blog.
Thanks! I’ll report back if it works. I’ve noticed it on my 3 of my 5 blogs, and the have the most images. They were woking fine when I first posted, but lately, a few hours later and there’s broken images to new posts too. On one with a gallery, a few thumbnails are broken but the images are there when I click. It’s so random. Hoping this’ll do the trick. Thank you.
Hello. 12 hours of my life searching for fix broken images in my Web site, and I fix it with your solution. Thank you very much. https://en.wikipedia.org/wiki/Occam%27s_razor the simplest the better. Grettings from San Jose Costa Rica.
Hi gus,
I’m having this issue! This post is 6 years-old! So, I’m wondering if this is still a solution?
Thank you in advance for your help! I will appreciate it very much