![]() ![]() This is as simple as adding the following line to your. I did this with PHP but these concepts should transfer to any language. So, I’ll give you an outline of what I did and hopefully you can adapt the solution to work for your needs. I dream of polishing off every little pet project I’ve got, but in reality, I can’t see it happening anytime soon. So … I’d share the entire code for this solution but it’s embedded in all the rest of my error handling mess that I’d rather keep to myself for now. Certainly adding a header or query param to the request could help avert this.) 404 error handler calls the target page, which calls my 404 error handler again. Although I had a way around it, the risk of infinite recursion (and consuming all the server’s threads) was greater than I wanted to accept. I initially tried implementing this retry on the server side to keep the client unaware of what was going on. After a threshold is reached, it will stop trying and display an error message. ![]() The gist of the solution is to add a custom 404 error handler that spits out some Javascript that retries the request and, if it receives a 200 response, replaces the body of the page with that content. The hypothesis I’m testing with this solution is that the 404 error resolves itself automatically within about a second. So, this evening, I set out to create a workaround. Not only would I like to reduce some of the noise, but I also want to avoid losing business if someone happens across a 404 error. In any case, my problem is still not resolved, and I continue to receive emails when these 404s occur. Not so convinced myself most of those results are people confused about how to configure mod_rewrite. ![]() They suggested that they are “pretty sure that Litespeed developers are aware of the issue” and that it is a known issue because a Google Search for “htaccess rewrite problem litespeed” yields lots of results. I concluded there’s some sort of bug in Litespeed and escalated to the Fluid Hosting support folks. If I hit the URL myself after receiving notification of the failure, it would work. Within a few seconds, the access logs reported a URL matching the same rewrite rule with a 200 OK response. ![]() I noticed a few months back that I’d get an occasional 404 error for a page that I know exists and is handled by a mod_rewrite rule. Who doesn’t these days? IIS 7 even has a URL rewriting module that will convert your mod_rewrite rules. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |