.htaccess
can be used to set a custom error pages that matches the theme of your website instead of seeing a white error page with black techno-babble when users end up on at a page with an error server response code. The error page can be any browser parseable file, including (But not limited to) .html, .php, .asp, .txt, .xml.
Examples for almost all common error response codes:
#Client Errors
ErrorDocument 400 /mycool400page.html # Bad Request
ErrorDocument 401 /mycool401page.html # Unauthorized
ErrorDocument 402 /mycool402page.html # Payment Required
ErrorDocument 403 /mycool403page.html # Forbidden
ErrorDocument 404 /mycool404page.html # Page Not Found
#Server Errors
ErrorDocument 500 /mycool500page.html # Internal Server Error
ErrorDocument 501 /mycool501page.html # Not Implemented
ErrorDocument 502 /mycool502page.html # Bad Gateway
ErrorDocument 503 /mycool503page.html # Service Unavailable
ErrorDocument 504 /mycool504page.html # Gateway Timeout
ErrorDocument 505 /mycool505page.html # Internal Server Error
It is always good practice to include Error Documents for the most common error responses, 400, 403, 404, and 500, as these errors are able to occur on all browsers.
the 500 error is one of the most notorious errors as it occurs if anything fails while loading the page to send, most commonly server html preprocessing failures from things like PHP, ASP, and other html preprocessors. It is good practice while testing to set the 500 page to display the error that occurred, rather then an unspecific 500 error page.
To enable the 500 error page to write a specific error see one of the following based on what html preprocessor you are using: php asp