PDA

View Full Version : PHP header() ignored


QuantumNet
12-02-2008, 12:53 PM
I use mod_rewrite to rewrite URLs. If the receiving index.php doesn't find content to serve for the URL, it issues something along the lines of:
header("HTTP/1.0 404 Not Found");
file_get_contents('404.html');

the problem is Litespeed does not recognise this as a 404 error and the browsers do not either.

This works fine on Apache.



--Stephen

mistwang
12-02-2008, 07:16 PM
It should work, at least it should display a 404 error page.
Have you checked the reply with firebug? What do you get with litespeed?

With Litespeed, you can do it in another way.

Only put

header("status: 404" );

in PHP, then add a custom 404 error page pointing to 404.html .