HomeApache Page 3 - Custom Error Pages with Apache
Internationalized error pages - Apache
Nobody enjoys seeing an error page. It's worse if the error page gives you little or no information to help you find the page you were trying to reach. Fortunately, there are ways to configure Apache so that your visitors need never feel so abandoned. This article explains how to set up custom error pages with Apache.
You neednít stop there however; if you scroll down through the conf file just a little more, youíll see a section covering "internationalized error messages" which work on a system of master error pages, containing standard error messages in many different languages, repeated throughout the file:
At run time, when an error occurs, the error page is constructed using server-side includes to build the page from several template html files (bottom, top and spacer), and content-negotiation to grab the actual text for the error message in the preferred language.
If you go to the error page directory in the Apache program folder, which is C:\Program Files\Apache Group\Apache2\error on a default Windows installation, you can see all of the internationalized error pages, and within this folder is also the include folder containing the header, footer and spacer pages.
To switch this feature on, you need to copy everything from the Apache error directory to a directory in your sites hierarchy, then uncomment out the block of lines beginning with the Alias directory and ending with the ErrorDocument 506 directive. Finally, the Alias directive needs to be changed so that it shows the path to the directory you have just created; you also need to update the Directory container to show the same path. Donít forget that the Windows standard backslashes need to be changed to forward slashes before the paths will be accepted by Apache.
When you try this, make sure that you comment out any of the ErrorDocument directives used previously. Also, note that when this is configured correctly and works, you donít need to worry about whether or not the internationalized error messages will be shown in Internet Explorer Ė they will, even with the "show friendly error messages" preference set because the server-generated page is greater than 512 bytes.