Custom Apache Error Messages
Contents |
refer to the current version of httpd instead, documented at: Current release version of Apache custom 500 page HTTP Server documentationYou may follow this link to go to the
Apache Custom Error Log Virtualhost
current version of this document.Custom Error Responses Available Languages: en | es | fr | ja | apache custom 404 error page ko | tr Additional functionality allows webmasters to configure the response of Apache to some error or problem. Customizable responses can be defined to be activated in custom error messages rails the event of a server detected error or problem. If a script crashes and produces a "500 Server Error" response, then this response can be replaced with either some friendlier text or by a redirection to another URL (local or external). Behavior Configuration Custom Error Responses and Redirects Behavior Old Behavior NCSA httpd 1.3 would
Apache Error Codes
return some boring old error/problem message which would often be meaningless to the user, and would provide no means of logging the symptoms which caused it. New Behavior The server can be asked to: Display some other text, instead of the NCSA hard coded messages, or redirect to a local URL, or redirect to an external URL. Redirecting to another URL can be useful, but only if some information can be passed which can then be used to explain and/or log the error/problem more clearly. To achieve this, Apache will define new CGI-like environment variables: REDIRECT_HTTP_ACCEPT=*/*, image/gif, image/x-xbitmap, image/jpeg
REDIRECT_HTTP_USER_AGENT=Mozilla/1.1b2 (X11; I; HP-UX A.09.05 9000/712)
REDIRECT_PATH=.:/bin:/usr/local/bin:/etc
REDIRECT_QUERY_STRING=
REDIRECT_REMOTE_ADDR=121.345.78.123
REDIRECT_REMOTE_HOST=ooh.ahhh.com
REDIRECT_SERVER_NAME=crash.bang.edu
REDIRECT_SERVER_PORT=80
REDIRECT_SERVER_SOFTWARE=Apache/0.8.15
REDIRECT_URL=/cgi-bin/buggy.pl Note the REDIRECT_ prefix. At least REDIRECT_URL and REDIRECT_QUERY_STRING will be passed to the new URL (assuming it's a cgi-script or a cgi-include). The other variables will exist only if they existed prior to the error/problem. None of these will be s
no longer maintained. Upgrade, and refer to the current version of httpd instead, documented at: Current release version of Apache HTTP Server documentationYou may follow this link to go to the current apache error 302 version of this document.International Customized Server Error Messages Available Languages: en Warning: This document php error messages has not been fully updated to take into account changes made in the 2.0 version of the Apache HTTP Server. Some
Mysql Error Messages
of the information may still be relevant, but please use it with care. This document describes an easy way to provide your Apache HTTP Server with a set of customized error messages which take advantage http://httpd.apache.org/docs/2.0/custom-error.html of Content Negotiation and mod_include to return error messages generated by the server in the client's native language. Introduction Creating an ErrorDocument directory Customizing Proxy Error Messages HTML Listing of the Discussed Example Introduction By using SSI, all ErrorDocument messages can share a homogenous and consistent style and layout, and maintenance work (changing images, changing links) is kept to a minimum because all layout information can be kept http://httpd.apache.org/docs/2.0/misc/custom_errordocs.html in a single file. Error documents can be shared across different servers, or even hosts, because all varying information is inserted at the time the error document is returned on behalf of a failed request. Content Negotiation then selects the appropriate language version of a particular error message text, honoring the language preferences passed in the client's request. (Users usually select their favorite languages in the preferences options menu of today's browsers). When an error document in the client's primary language version is unavailable, the secondary languages are tried or a default (fallback) version is used. You have full flexibility in designing your error documents to your personal taste (or your company's conventions). For demonstration purposes, we present a simple generic error document scheme. For this hypothetic server, we assume that all error messages... possibly are served by different virtual hosts (different host name, different IP address, or different port) on the server machine, show a predefined company logo in the right top of the message (selectable by virtual host), print the error title first, followed by an explanatory text and (depending on the error context) help on how to resolve the error, have some kind of standardized background image, display an apache logo and a feedback email addr
you upgrade your browser to one which is compatible with CSS. For more information, please visit our Browser Upgrade page. Home FAQs Forums Links News http://www.4webhelp.net/tutorials/misc/errors.php Online Tools phpBB Scripts Tutorials: Apache CSS Databases Graphics Hosting HTML & XHTML Miscellaneous Perl PHP About us Contact us Contribute Credits Link to us News: RIP Netscape Navigator IP Atlas Updated Tutorial comment spam Forum problems phpBB Upgrades Search: Creating Custom Error Messages in Apache by eKstreme Last updated: 02/05/2012 Write a tutorial for us Bookmark this tutorial Print this tutorial Comment on error messages this tutorial In order to have a complete understanding of what a .htaccess file is, I suggest that you also read our Control File Defaults tutorial and our Password Protection tutorial. Introduction The .htaccess file is a file found in Apache servers that allows you to manipulate the behaviour of the server. A very common use is to create custom error messages for server custom apache error errors. Examples of such errors are "404 Not Found" (say when you click on a broken link), and the "500 Internal Server Error" (a script failed). Most hosts allow you to have your own .htaccess file, and so now we will look at only one of the things we can do with a custom .htaccess. Some quick notes before we start: under Windows, you cannot save a file with the name of ".htaccess". An easy trick is to create a file called htaccess.txt and edit that. Uploading of the file (regardless of its name) must be done in TEXT/ASCII mode (not BINARY). Finally, under Unix, any file that starts with a '.' is invisible, so when you upload your file, you may not see it. If you uploaded a file called htaccess.txt, just rename it to .htaccess using your FTP client. Custom Error Messages What you can do with .htaccess is tell the server to display a special page to the user in case of an error. This page should, ideally, tell the user that something is wrong, down-play the fact that someone messed up (probably you as the webmaster!