Single ErrorDocument directive to catch all errors (.htaccess)

mkvlrn picture mkvlrn · Apr 10, 2010 · Viewed 14.8k times · Source

Is there something like a wildcard directive to catch all possible errors and deal with them in a single custom error page?

ErrorDocument 404 /error.php?code=404
ErrorDocument 403 /error.php?code=403
...
ErrorDocument NNN /error.php?code=NNN #possible use of RegExp?

I know I probably won't be dealing with a lot of custom error pages here, but I'm curious about this.

Answer

Gumbo picture Gumbo · Apr 10, 2010

That is not possible. You need to have a ErrorDocument directive for each status code you want to handle differently than with the default error handler.