Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For my personal website, I wanted to make a webpage for every error that could come up on an Apache web server - so that it could fit in better with the style of the website instead of the generic Apache messages. As far as I know, the only way to do that would be to create individual webpages for all 50-some error codes, and individual ErrorDocument entries for each one of those. Is there a way to handle them dynamically (I.e. redirect all errors to a webpage with the error code as a GET/POST value)?

share|improve this question
PatomaS touched on this in his answer, but there are considerably less that "50-some" error codes that can be trapped with the ErrorDocument directive and probably only a handful (if that) that will actually occur. – w3dk Mar 27 '14 at 13:10
up vote 3 down vote accepted

The best way is to create one ErrorDocument per page, but redirect all errors to the same page. This gives you the dynamic part that you want while you still can change easily that configuration at any time reassigning a new ErrorDocument for specific cases.

Then on that page, you can configure different processes or responses, depending on the REDIRECT_STATUS header.

For the specific situation of the 500 errors, consider that those are server errors, so even when you have an ErrorDocument configured for that situation, it may not be possible to use it, so in some cases just the default message will be presented to the user.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.