Apache2 issues: index.html.old & MultiViews, and mod_userdir

by Juliet Kemp

On upgrading my webserver recently (from RHEL3 to Debian stable, fwiw), I discovered an issue with renamed/old versions of index.html in the new version of Apache (2.0.54).

A user had two files in his public_html directory - home.html, which was what he wanted as his homepage (i.e. to be served up for http://server.net/~user/); and index.html.old, an old version of that page. Under our previous setup, this had worked fine. Under the new one, index.html.old took priority over home.html, and was therefore served; despite the fact that home.html was listed under DirectoryIndex in the config (and index.html.old wasn't, although of course index.html was). Changing the name of the old page to index_old.html worked to fix it.

It transpires that this is related to the Apache MultiViews functionality. MultiViews is an option which means that Apache will translate a request for 'index' to 'index.*', with the value of * depending on what it can find in the relevant directory. So, if some of your site has index.php and some has index.html, you don't need to set both of these under DirectoryIndex in the config, because all requests for 'index' will automatically be translated. (Myself, I'm not sure that this is worth it, particularly, but it does appear to be on by default.) So, in the absence of an actual index.html file, index.html.old fitted the bill for http://server.net/~user/ better than home.html, despite the fact that the latter was explicitly listed in DirectoryIndex.

(It's possible that listing home.html earlier in the DirectoryIndex list would also have fixed this problem; order does matter in at least some Apache directives.)

So: Feature Not Bug.

I also ran into another minor problem today, after an issue elsewhere broke my LDAP automount maps and forced me to manually mount the NFS /home directory on the webserver. Specifically, the UserDir public_html directive in mod_userdir config stopped working (requests for http://server.com/~user/ returned 404). The Apache docs noted that you can have more than one value for this directive; using UserDir public_html /home/*/public_html did the trick (always remember to reload the config afterwards!).


2006-06-21 05:46:26
I think this is horrible that such a mature product that is being used by millions has these simple bugs in them. These types of bugs should have been caught before release. If IIS had these bugs there would be riots in the streets and people saying this doesn't happen to open source.