Mobile app version of vmapp.org
Login or Join
Mendez628

: Handle an HTTP error dynamically in Apache 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

@Mendez628

Posted in: #Apache2

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)?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Mendez628

1 Comments

Sorted by latest first Latest Oldest Best

 

@Cugini213

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.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme