DevHeads.net

Postings by David Wakelin

Can I return a 404 for a file that is also the ErrorDocument?

I have created a file 404.html to act as my 404 page that is returned by
ErrorDocument:

ErrorDocument 404 /404.html

This works fine, except when accessing 404.html directly, which returns a
status code of 200

I've attempted a RewriteRule like so:

ErrorDocument 404 /404.html
RewriteRule "404\.html" - [R=404]

However, this now returns an error instead of my 404.html doc:

The requested URL /does-not-exist.html was not found on this server.
Additionally, a 404 Not Found error was encountered while trying to
use an ErrorDocument to handle the request.

How can I return a status of 404 for the