Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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
1  
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. –  w3d Mar 27 at 13:10

1 Answer 1

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

 
discard

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.