Reputation: 6064
404 error page's 200 OK
header error:
Server Response:
http://www.example.com/err404.html HTTP
Status Code: HTTP/1.1 200 OK
And it should give 404, my client says.
Upvotes: 0
Views: 9797
Reputation: 655239
I guess that you use ErrorDocument
with an absolute URL like:
ErrorDocument 404 http://example.com/err404.html
In that case the server responds with a 302 redirect with http://example.com/err404.html as the location. If that URL is then requested, your server is sending the 200 status code as you experienced.
Try just an absolute URL path instead:
ErrorDocument 404 /err404.html
Upvotes: 8
Reputation: 1108722
You will get status 200 if the error page was the actual request (i.e. the error page is requested directly by browser address bar, a bookmark, a redirect in PHP, etc). You will get status 404 if the error page was returned by the webserver itself when there's actually means of invalid request, or when it is dynamically included by PHP along with header("HTTP/1.1 404 Not Found");
. In Apache HTTP server the locations for custom error pages are configureable somewhere in httpd.conf
.
Upvotes: 4