0
votes

I have RewriteRule /somefile.php index.php [L] in my .htaccess and header("HTTP/1.0 404 Not Found"); in my index.php. But 404 don't work, and I getting blank page. Why?

header("HTTP/1.0 404 Not Found"); works without htaccess file.

Don't ask me why I doing like this. :D

2

2 Answers

0
votes

Probably your php is a fastcgi, then you need to do header("Status: 404 Not Found") instead. Or your headers are already sent, in which case you may need to set output buffering for php. And check your logs ;-)

0
votes

in phpinfo I have Server API CGI/FastCGI. and I discovered that header("Status: 404 Not Found") working only in IE. In Chrome/Firefox I see only blank page. some browsers also show custom error messages if they not more than 256 or 512 characters