Wordpress LScache Plugin: With so many asset 404 errors, it would not be possible to redirect with JS?
Last Updated on: Wed, 15 Apr 2026 00:00:02 Hello Just an idea! Maybe the community can help? Im trying to write with inline JS that listens for errors in Waterfall, if any asset has a 404, preferably a CSS or JS, then the user is redirected to the same URL but with the query parameter: ?nocache=1 Much better than a quick answer is a readable answer, which is not possible if a CSS or JS fails. And since Im already talking to the plugin creators, we could also detect if that URL was requested many times for the uncached version, if it was requested more than 10 times, then clear the cache of that URL. There is a way to do what you like to get, but not with Javascript. You need server function for it and could be done with SetEnvIfExpr Directive. The problem is that this solution only works with Apache web server. The LiteSpeed web server is Apache compatible, but not 100% and doesnt support expressions. @CacheCrawler Thanks for the tip!I use OLS server, so Ill have to research how to do this on it, its already a way! (But did you understand that the page doesnt give a 404, but the CSS and JS assets? Its just that I found how to redirect only the page when it presents 404 with this directive) Thank you very much! And much better than Javascript. Does anyone from plugin development know how to do this in OLS? I use OLS server, so Ill have to research how to do this on it, its already a way! In this case there is no difference between OLS and LSWS, so it is impossible. A status code cant be triggered directly and you need SetEnvIfExpr directive to check the status code if it is not the main document. And much better than Javascript. Status code cant be triggered with Javascript. Hi, apologize for the inconvenience , this is known issue and we have a beta version to address it please try go to toolbox -> beta test -> copy paste this link https://github.com/litespeedtech/lscache_wp/commit/70d164b5b85a66e3483c2505b6c09c30d3bbbf64 then upgrade Best regards,
LiteCache Rush: Speed comes from using less, not from doing it faster
Reference