Setting the Status
header is not working in PHP CGI. I am using PHP on the IIS webserver.
header('HTTP/1.1 404 Not Found');
header('Status: 4开发者_运维百科04 Not Found');
Do you have any ideas why this might not be working?
Simply sending a Status
header from PHP does not make your webserver return it's default error page. You need to do this yourself. Either you generate the contents for an error page like you would render any other page, or you redirect to another URL and configure your webserver to display an error page for you.
For example, you could do this in PHP:
header('Location: /404.html');
Then configure your webserver to serve 404.html as a 404 error.
精彩评论