Apache
  Home arrow Apache arrow Custom Error Pages with Apache
Dev Shed Forums 
Administration  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Download TestComplete 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
IBM Developerworks
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
APACHE

Custom Error Pages with Apache
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 10
    2006-04-03

    Table of Contents:
  • Custom Error Pages with Apache
  • Creating a custom error page
  • Internationalized error pages
  • Maintaining and updating error pages

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
     
    ADVERTISEMENT

    TestComplete™ automates software testing for a fraction of what the big guys charge. Easy functional and load testing for all Windows, .NET, Java and Web apps. Download a free trial now.

    Custom Error Pages with Apache
    (Page 1 of 4 )

    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.

    Apache, as you know, is the most popular web server in use today. Since it is historically easily installed, easily configured and very flexible, it’s not difficult to see why.  Many of the easily configured options that are possible with Apache, however, are not exploited to their fullest.  Most of Apache's various server configuration options are switched off by default, and although this makes the server much more secure, it also means that a default installation will not take advantage of many of the things that make Apache what it is.  The httpd.conf file, Apache’s main configuration file, actually says in section 2: "Note that from this point forward you must specifically allow particular features to be enabled…"

    Error messages are certainly a pertinent example of this; Apache can very quickly and easily be set to display almost anything you want, from simple text (yuk) to custom HTML pages or even PHP and Perl scripts.  It’s all too common, however, to see the very plain, default error messages that are displayed when the server encounters the standard set of errors, such as the all too familiar 404 or "Page not found" error response.  These default pages are ugly, sometimes confusing, very often nothing like the rest of site and almost always detrimental to user experience.  There’s no excuse for sticking with these default error pages, especially when it really is so very easy to use alternatives of your own devising.

    Anyone reading this is going to be using Apache, if not in production, then at the very least as a development tool, but the browser you use for testing can also have an impact on your work.  With the default set up of Apache, if you use Mozilla to try to access a page that does not exist you will see the default Apache server 404 error page, but if you use MS IE5+ you won’t see the default Apache 404. Instead, you’ll see the default Internet Explorer 404 page.  This is Microsoft’s so called "friendly error message" which overrides the Apache defaults.  The reason for this is that the Apache defaults are all less than 512 bytes. 

    This overriding featuring of IE can be switched off using the "show friendly error messages" setting in the Tools -> Internet options dialogue, although by default it is set to on, so bear in mind that most people will have this set if they are using IE (which a large number of Internet users are).  This isn’t overly important but should be taken into consideration; to overcome this setting automatically, you need to ensure that the pages you wish to use as error pages are larger than 512 bytes.  This isn’t too difficult to achieve, but if you aren’t seeing what you should be seeing when creating and testing your error documents, it would be wise to check the file size of your error pages or disable this feature in IE.

    More Apache Articles
    More By Dan Wellman


       · Hi,I hope you enjoy learning how to set-up these very simple mechanisms that can...
     

       

    APACHE ARTICLES

    - Putting Apache in Jail
    - Containing Intrusions in Apache
    - Server Limits for Apache Security
    - Setting Permissions in Apache
    - Installing Apache
    - Apache Installation and Configuration
    - Apache Tapestry and Custom Components: DateI...
    - Tapestry and AJAX: Autocompleter and InlineE...
    - PropertySelection and IPropertySelectionMode...
    - The DatePicker and Shell Components of Apach...
    - Apache Tapestry: ASO and More Components
    - Apache Tapestry and DirectLink, IoC and DI
    - Making a CelebrityCollector with Apache Tape...
    - Apache Tapestry and Listener Methods, Condit...
    - The Properties of Tapestry Pages

     
    Accelerating Trading Partner Performance
     
    Competing on Analytics
     
    Cost Effective Scaling with Virtualization and Coyote Point Systems
     
    Five Checkpoints to Implementing IP Telephony
     
    Hosted Email Security: Staying Ahead of New Threats
     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway