Introduction
Some customers want to internationalization and customize error messages to display in end-user browser, whenever some error occurred in the server side. Ex: Tomcat server is down; some server resources are not available etc.
This document talks about customize error message and internationalize error messages–
The version I used is –
1. Apache2.2
Please follow the following step to configure successfully…
1) Customize error message –
a. Open “httpd.conf” from “C:\Program Files\Apache Software Foundation\Apache2.2\conf”and search for “ErrorDocument” word in the doc.
b. You can find something like –
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 “The server made a boo boo.”
#ErrorDocument 404 /missing.html
#ErrorDocument 404 “/cgi-bin/missing_handler.pl”
c. Just uncomment whatever error code message you would like to display.
Ex:
ErrorDocument 404 /missing.html
d. Syntax:ErrorDocument error-code document
e. Create the file (missing.html) in the following path “C:\Program Files\Apache Software Foundation\Apache2.2\htdocs”
f. Whenever you have got 404 error code – missing.html would display.
2) Internationalize error messages
a. Open “httpd.conf” from “C:\Program Files\Apache Software Foundation\Apache2.2\conf”and search for “ErrorDocument” word in the doc.
b. You can find something like-
# Customizable error responses come in three flavors:
c. And above to this line add the following code in “httpd.conf” –
Alias /error/ “C:/Program Files/Apache Software Foundation/Apache2.2/error/”
<Directory “C:/Program Files/Apache Software Foundation/Apache2.2/error”>
AllowOverride None
Options IncludesNoExec
AddOutputFilter Includes html
AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority en cs de es fr it nl sv pt-br ro
ForceLanguagePriority Prefer Fallback
</Directory>
ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
d. So finally, it would appear like this –
Alias /error/ “C:/Program Files/Apache Software Foundation/Apache2.2/error/”
<Directory “C:/Program Files/Apache Software Foundation/Apache2.2/error”>
AllowOverride None
Options IncludesNoExec
AddOutputFilter Includes html
AddHandler type-map var
Order allow,deny
Allow from all
LanguagePriority en cs de es fr it nl sv pt-br ro
ForceLanguagePriority Prefer Fallback
</Directory>
#
# Customizable error responses come in three flavors:
# 1) plain text 2) local redirects 3) external redirects
#
# Some examples:
#ErrorDocument 500 “The server made a boo boo.”
#ErrorDocument 404 /missing.html
ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
#ErrorDocument 503 /missing.html
#ErrorDocument 404 “/cgi-bin/missing_handler.pl”
e. If you to customize the error message displayed from “HTTP_SERVICE_UNAVAILABLE.html.var”
i. You can open the “HTTP_SERVICE_UNAVAILABLE.html.var” file in some text editor
ii. And change the message under appropriate language type-
Ex: “Content-language: en”
3) internationalized error documents ref
a. http://www.devshed.com/c/a/Apache/Custom-Error-Pages-with-Apache/2/
b. http://www.linuxforums.org/forum/servers/42579-help-apache-error-message.html
c. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=467004
d. http://www.experts-exchange.com/Software/Server_Software/Web_Servers/Apache/Q_23365486.html