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

 
Developer Updates  
Free Website Content 
 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? 
Google.com  
APACHE

Custom Error Pages with Apache
By: Dan Wellman
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 11
    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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    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
     

       

    APACHE ARTICLES

    - Creating a VAMP (Vista, Apache, MySQL, PHP) ...
    - 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...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek