Cool Apache feature
by Volker Weber
There is hardly a day where I don't learn something I did not know the day before. Today it was mod_speling which automagically repaired a broken link on my site. I was referring to http://vowe.net/images/googlead.php where I should have linked to http://vowe.net/images/googleads.php. Still you could get to this page, as you can try yourself. So, how does that work?
Requests to documents sometimes cannot be served by the core apache server because the request was misspelled or miscapitalized. This module addresses this problem by trying to find a matching document, even after all other modules gave up. It does its work by comparing each document name in the requested directory against the requested document name without regard to case, and allowing up to one misspelling (character insertion / omission / transposition or wrong character)
Comments
At least in Apache 1.3, mod_speling seems not to work in conjunction with MultiViews: If you have page.html.en and page.html.de, all of page, page.html, page.html.en and page.html.de will work. But mod_speling will only correct the spelling of the full URI, not those enabled by MultiViews. So, pege.html.en and pege.html.de are found, but pege.html and pege not.
I have not tested Apache 2, though.
Which is exactly as specified by the documentation. You have to keep in mind that you are talking about two different modules here. First, the multiview module tries to find a match for "pege.html" and "pege". Because it doesn't find a match for them, the request is passed on to mod_speling. As stated in the docs, mod_speling will only correct one letter errors. In your scenario, it would have to correct four, the typo as well as the missing extension for mod_speling only works on real file names as given back by a directory listing. Just imagine what would happen if mod_speling instead of just searching a directory would pass each likely prospect to the URI parser again. It might well be able to correct most if not all typos and omissions but at the price of a real slow website.
For your scenario to make mod_speling also correct requests for "pege.html" automagically, you would have to add another document called "page.html" that contains the content in your default language of choice. Still, there's no way to automagically fix requests for "pege".
While I do accept the technical reason, I would rather prefer a slow response over a 404. Asking mod_speling is only needed in case of a typo and shouldn't affect the response time of correct requests.
I solved pege.html by symlinking page.html to page.html.en (with English being the default language). But I don't know a solution for "pege" either.
There isn't one - at least there's none that I know of. The major problem here is, that you would have make mod_speling to not only check for typos and omissions. In addition, it would have to check for all valid extensions as given in the Apache configuration, too. While I believe this could be done by hacking the code of mod_speling, I for one wouldn't do it. I'm not into teaching users that they are allowed to be sloppy ;-)
Apache rocks! It's not hard to see why its the leading Web Server on the Internet.
Post a comment
Recent comments
Oliver Barner
on Sorry Storm, I failed you at 08:15
Leo Peralta
on BlackBerry Storm too nervous at 07:19
Glen Salmon
on Sorry Storm, I failed you at 01:38
Volker Weber
on Der Darmstädter Notebook-Händler at 01:00
pierre kerchner
on Der Darmstädter Notebook-Händler at 00:49
Ed Brill
on Sorry Storm, I failed you at 00:22
Volker Weber
on Der Darmstädter Notebook-Händler at 00:14
Joerg Michael
on Sorry Storm, I failed you at 00:14
pierre kerchner
on Der Darmstädter Notebook-Händler at 00:11
Volker Weber
on Sonos gear at 50% off at 23:53
Volker Weber
on Sorry Storm, I failed you at 23:52
Glen Salmon
on Sonos gear at 50% off at 23:50
Volker Weber
on Der Darmstädter Notebook-Händler at 23:49
Glen Salmon
on Sorry Storm, I failed you at 23:43
pierre kerchner
on Der Darmstädter Notebook-Händler at 23:42
Daniel Seiler
on Nokia announces N97 at 23:38
Volker Weber
on Sonos gear at 50% off at 23:06
Stuart McIntyre
on Sonos gear at 50% off at 23:04
Thomas Cloer
on Symbian-Unterstützung für 1&1 MailXchange at 22:56
Colin Williams
on Nokia advertises Lotus Notes Traveler at 22:34
Volker Weber
on Windows blues at 20:01
Michael Kobrowski
on Windows blues at 19:47
Vilhjalmur Helgason
on IT Factory goes bankrupt. Again. at 19:30
Olaf Boerner
on Es gibt Sachen, die verkaufen sich von selbst at 19:27
John Ash
on Reconsidering Physical Key Secrecy: Teleduplication via Optical Decoding at 18:57



