The Apache HTTP server, is a very capable but also very complicated piece of software. Configuring it seems to be an art form of sorts.

When this site was a wiki, it ran under Apache, using the Named Virtual Hosts feature (of Apache and of HTTP/1.1). Mostly Named Virtual Hosts work smoothly and flawlessly but there are occasional, and surprising, glitches.

One is the result of the following Alias directive, in the global server config, here to make pretty (ie, full of icons) directory indexes possible:

  Alias /icons/ "/usr/local/www/icons/"

What this means is that any request URI, to any virtual host (as it turns out), that is prefixed with "/icons/" will be mapped to "/usr/local/www/icons/" in the filesystem.

I didn’t initially notice this because this site (when it was a wiki), was running in a subdirectory (“wiki”) of nimblemachines.com. This means that any request URIs looked like

  /wiki/<something>

There are several icons that every page displays: the lambda at the top, and the two W3C validator icons at the bottom. They had (until I was forced to move them) the following (relative) URIs, respectively:

  icons/lambda.gif
  icons/valid-xhtml10.png
  icons/valid-css.png

and accessing them caused no problems because the request URIs looked like this:

  /wiki/icons/lambda.gif
  /wiki/icons/valid-xhtml10.png
  /wiki/icons/valid-css.png.

But when I tried running the same wiki code in another domain, but in that domain’s root directory, I ran into a problem. Now the request URIs looked like this:

  /icons/lambda.gif
  /icons/valid-xhtml10.png
  /icons/valid-css.png

and Apache “helpfully” rewrote the initial "/icons/" with "/usr/local/www/icons/" and therefore could not find the icons for the wiki.

So, I had to rename my icons subdirectory to “images” so as not to conflict with Apache. Sigh.

Happily, this has since changed. Now that part of the Apache config file looks like this:

  #Alias /icons/ "/usr/local/www/icons/"
  #<Directory "/usr/local/www/icons">
  #    Options Indexes MultiViews Includes
  #    AllowOverride None
  #    Order allow,deny
  #    Allow from all
  #</Directory>

2013 January 23 16:00

There is no way not to consider the above behaviour a bug. I don’t remember which version (or versions) of Apache exhibited this behaivour, or whether it has been fixed, but it was certainly a surprise.