Image names being changed by LiteSpeed breaks image links and I get "404 Not Found nginx" (examples included)

#1
Hello! My site (pbjlearning.com) has a blog and I added LiteSpeed to help image loading.

Randomly, images were not working on the site, and after digging in, it appears what is happening is the filenames are being changed in LiteSpeed, and the connection through my WordPress media get broken when the names don't match.

Here is one image example

From this post:
https://pbjlearning.com/2022/06/27/more-reports-on-intl-day-against-drug-abuse-nagaland-post/

In WordPress (media and the blog post that displays it), the file is referred to as its ORIGINAL filename:
https://pbjlearning.com/wp-content/...intl-day-against-drug-abuse-nagaland-post.jpg (PLEASE NOTE THE ORIGINAL DOES NOT HAVE DIMENSIONS IN THE FILENAME)

On my fileserver, the file has been turned into a bunch of files, (there was never a version called "768x576"):
more-reports-on-intl-day-against-drug-abuse-nagaland-post-768x576.jpg
more-reports-on-intl-day-against-drug-abuse-nagaland-post-768x576.jpg.webp
more-reports-on-intl-day-against-drug-abuse-nagaland-post-768x576.bk.jpg
more-reports-on-intl-day-against-drug-abuse-nagaland-post-600x450.jpg.webp
more-reports-on-intl-day-against-drug-abuse-nagaland-post-600x450.jpg
more-reports-on-intl-day-against-drug-abuse-nagaland-post-600x450.bk.jpg
more-reports-on-intl-day-against-drug-abuse-nagaland-post-300x225.jpg.webp
more-reports-on-intl-day-against-drug-abuse-nagaland-post-300x225.jpg
more-reports-on-intl-day-against-drug-abuse-nagaland-post-300x225.bk.jpg
more-reports-on-intl-day-against-drug-abuse-nagaland-post-100x100.jpg.webp
more-reports-on-intl-day-against-drug-abuse-nagaland-post-100x100.jpg
more-reports-on-intl-day-against-drug-abuse-nagaland-post-100x100.bk.jpg
NOTE THE ORIGINAL FILE IS NOT ON MY SERVER ANY LONGER

Here are my questions:
1) This does not happen on every post / image. Why would some work and others not?
2) How can I fix this without going through each and every blog, seeking the original filename, and then individually renaming those files?
3) Even if I do go back and rename them all:
a) would they get re-optimized and the original change again?
b) would those additional images (with the file sizes, etc) be used for optimization?
4) How can I prevent this from breaking images in the future? All I can think of right now is to disable LiteSpeed. Yikes!

Ultimately it looks like what's happening is that the optimization is removing (or completely renaming) the original file and this renaming is breaking the link from the blog to the image file.

Ideas?
 

Attachments

Last edited:
#3
You need to have LiteSpeed web server running to use all features from cache plugin.
I appreciate that advice!!

Couple of questions:
- Will that fix my current, broken images?
- Why would I need "all features" to fix what appears to have been broken by the current version?
- Is this the best place to start? https://docs.litespeedtech.com/lsws/cp/cpanel/quickstart/
- I am using a shared server, but I don't know about the 2 gig RAM limitation. Why would LiteSpeed break my images and force me to use this cache feature that may cost me money?

I'm going to look into this tomorrow.

Mostly I'm confused as to why LiteSpeed would have broken my links. That is so weird.

Again, thank you SO MUCH for the answer!!
Billy Joe
 

serpent_driver

Well-Known Member
#4
Will that fix my current, broken images?
With a very high probability, yes, because LiteSpeed adds some rules to .htaccess. nginx doesn't use .htaccess.

Why would I need "all features" to fix what appears to have been broken by the current version?
There is nothing broken. LiteSpeed Cache plugin needs LiteSpeed webserver for many, but not all features.

If you have Shared Hosting you can't replace nginx with LiteSpeed, so you need at least a VPS with root access to install LSWS or you use a host that has LiteSpeed already installed.

I am using a shared server, but I don't know about the 2 gig RAM limitation. Why would LiteSpeed break my images and force me to use this cache feature that may cost me money?
You can also use OpenLiteSpeed. It's free, but needs a host where you can install OLS. And btw. Not everything in the world is for free.....
 

AndreyPopov

Well-Known Member
#5
On my fileserver, the file has been turned into a bunch of files, (there was never a version called "768x576"):
more-reports-on-intl-day-against-drug-abuse-nagaland-post-768x576.jpg
more-reports-on-intl-day-against-drug-abuse-nagaland-post-768x576.jpg.webp
more-reports-on-intl-day-against-drug-abuse-nagaland-post-768x576.bk.jpg
more-reports-on-intl-day-against-drug-abuse-nagaland-post-600x450.jpg.webp
more-reports-on-intl-day-against-drug-abuse-nagaland-post-600x450.jpg
more-reports-on-intl-day-against-drug-abuse-nagaland-post-600x450.bk.jpg
more-reports-on-intl-day-against-drug-abuse-nagaland-post-300x225.jpg.webp
more-reports-on-intl-day-against-drug-abuse-nagaland-post-300x225.jpg
more-reports-on-intl-day-against-drug-abuse-nagaland-post-300x225.bk.jpg
more-reports-on-intl-day-against-drug-abuse-nagaland-post-100x100.jpg.webp
more-reports-on-intl-day-against-drug-abuse-nagaland-post-100x100.jpg
more-reports-on-intl-day-against-drug-abuse-nagaland-post-100x100.bk.jpg

Ultimately it looks like what's happening is that the optimization is removing (or completely renaming) the original file and this renaming is breaking the link from the blog to the image file.
this is standard algorithm for work with images - make image cache.


- I am using a shared server, but I don't know about the 2 gig RAM limitation. Why would LiteSpeed break my images and force me to use this cache feature that may cost me money?

if you have shared hosting then some times have problems with server load.
on high server load image conversion algorithm can break and converted ("renamed") images can become broken.
you can see renamed file but it can zero or tiny size and not open in any viewer.

only one way to solve this: remove by hand all renamed files of this "broken" image
conversion algorithm make new copy

P.S. problem not in only in RAM limitation, CPU and disk load more prefer.

P.S.P.S. also problem may appear when original image have some incorrect information inside. then try open this image in image editor and save.
 
Last edited:
#6
Here's my current status.

I use a shared server. It uses too much RAM for the free version. And I understand free isn't perfect.

But I also believe that free shouldn't break my images. And it currently is.

I have gone through and done a lot of fixes, and I left LiteSpeed active. BUT now there are even more images broken.

I have to disable LiteSpeed because it CONTINUES to break my images.

I will have to go through and change all the images when I have time.
 
#7
Hey, I am using Litespeed cache on my website. Sometimes, I noticed that it is causing page loading speed. Which settings would you recommend to run my site fast. I am using images after compressing them in webp format via cloudconvert online tool.
 
Top