#StackBounty: #php #litespeed #headers LiteSpeed ignore PHP header 404 status

Bounty: 50

After moving my website to a webhost which uses LiteSpeed it seems PHP header is ignored.

I have tried these variations:

  • $s = "HTTP/1.1 404 Not Found";
  • $s = "HTTP/1.0 404 Not Found";
  • $s = "Status: 404 Not Found";
  • $s = $_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found';

followed by

header($s)

But on LiteSpeed these all seem to be ignored.

  1. Is there any option in LiteSpeed I can turn off to get Apache compatible behavior? I have access to cPanel and .htaccess
  2. Any other possible explanation and/or solution?

NOTES:

  • Problem happens on both https and http variations
  • The page returning 404 is a page used for mod_rewrites (so for URL queries where no valid content is found in database, 404 http response code should be returned)
  • Problem also happens on another domain of mine placed the server (using a popular PHP forum solution with a mod_rewrite based plugin for nice looking URLs)
  • The mod_rewrites themselves work fine so not 100% sure it is related.
  • Both sites work fine on those Apache servers I have tried through time (at least two different Apache webhosts + my localhost)

Also, on both websites I have disable LiteSpeed caching in my .htaccss file

<IfModule LiteSpeed>
RewriteRule .* - [E=Cache-Control:no-cache]
</IfModule>


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.