Apache
  Home arrow Apache arrow Page 2 - Handling 404 Error's With Apache
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Sun Developer Network 
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? 
APACHE

Handling 404 Error's With Apache
By: John Ferme
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 6
    2002-02-20

    Table of Contents:
  • Handling 404 Error's With Apache
  • Apache and hierarchies
  • Implementing a 404 trap
  • Conclusion

  • 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


    Handling 404 Error's With Apache - Apache and hierarchies


    (Page 2 of 4 )

    Apache is a very configurable web server, and it depicts a web site as a hierarchically structured set of files and directories. These directories are organized with parent-child relationships, like this:

    A typical file system setup

    Apache also supports configuration files knows as htaccess files. These files can be used to set various file/directory permissions, redirection attributes, and block users coming from a specific IP address, etc. Htaccess files are created with the filename ".htaccess" (notice the dot at the beginning of the filename) and can reside in any directory that an Apache server can process.

    Because of the way Apache works, if I had an htaccess file saved in a directory called home and this directory also contained several sub-directories, then each sub-directory would be influenced by the htaccess file in the home directory as well.

    Think of a situation in which you might want to password protect several directories on your web site; your web site may be structured with one main root directory and 23 sub-directories. By simply placing a specially designed htaccess file in the root directory, all 23 sub-directories are automatically protected as well. This is a great time-saver, because usually if you're modifying the attributes of one directory, then there's a good chance that you'd like the attributes of all of its sub-directories affected by affected as well.

    Hopefully you now understand the benefits of Apache thinking in terms of a hierarchy. We can use this hierarchical structure to our benefit by creating a htaccess file that can trap 404 errors and redirect the user to the appropriate page or perform some specific action depending on the URL that the visitor typed in. Let's do that now.

    More Apache Articles
    More By John Ferme


     

    APACHE ARTICLES

    - Programmatically Manipulating Microsoft Exce...
    - Installing PHP under Windows
    - Compressing Web Content with mod_gzip and mo...
    - Compressing Web Output Using mod_deflate and...
    - Setting Up Apache 2.0.45 to Parse PHP Pages
    - Custom Error 404 Documents with PHP
    - Using Apache and PHP on Mac OS X
    - ASP: Active Sessions, Active Logins and Tota...
    - Working With Oracle on Windows: Part 1
    - The Quick-n-Dirty Guide to Setting Up Apache...
    - Installing Apache With SSL: The Complete Gui...
    - 7 Powerful .htaccess Customization Tips
    - Trap And Get Notified: A Practical Solution ...
    - One Way To Use Server Side Includes
    - Using ForceType For Nicer Page URLs






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