mod_nocase.c - Robert Adams ( August 2001 
  based on mod_speling.c by Alexei Kosut <> June, 1996

Source: mod_nocase.c
Licence: Apache license

This module is a simple, transparent module that makes GET request URLs case insensitive. The algorithm first checks for an exact match (most hits) and if that doesn't work, it tries for a caseless matching.

URLs are often assumed to be case insensitive despite the feature of a UNIX style filesystem.  Actually,  RFC2396 (URI) and RFC2616 (HTTP 1.1) say that, when comparing two URLs for equivalence, the scheme name and the host name must be case-insensitive while the remainder of the URL should be compared in a case sensitive manner. That leaves the interpretation of URLs against a filesystem to convention and that convention goes both ways.

This module was built on mod_speling by removing the spelling and partial matching code.  mod_speling has several odd features that I wasn't too crazy about.  It could match a user's mistyping against anything on the site who's spelling was "close".  It also has the non-overridable feature of presenting an URL requester with a new page to select any of the possible matches.  I couldn't allow this "choice" selection dialog... that would confuse the users and possibly let people see other things in the directories.

1) As written, this only checks GETs so author your POSTs cleanly.
2) If there is more then one directory entry that matches, this filter returns the exact match or, if no exact match, the "first" match -- "first" in directory order. My presumption is that, if you are running a case insensitive site, you don't have entries that only differ by case.

Building and Configuration

This version has been built and tested on Mandrake 8 with Apache 1.3.20.  It shouldn't have any problems on any of the 1.3 versions of Apache, though since it doesn't do anything fancy.

These instructions are for the Apache 1.3 source build environment.

Copy mod_nocase.c into your apache source tree -- probably into $APACHEROOT/src/modules/extra/

To build a DSO version, add the following lines to the configuration:

./Configure --add-module=src/modules/extra/mod_nocase.c --enable-shared=nocase ...
make install

Edit Apache's httpd.conf and add "LoadModule" and "AddModule mod_nocase.c" in the appropriate blocks.  I put them just after the commented out entries for mod_speling.

The module is controlled by adding a "NoCase On|Off" directive in the appropriate <Directory> entries.  It can also appear in .htaccess files for specific directories.