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)

More >

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.

Steffen Uhlig, 2004-02-08

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".

Stefan Rubner, 2004-02-08

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.

Steffen Uhlig, 2004-02-08

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 ;-)

Stefan Rubner, 2004-02-08

Apache rocks! It's not hard to see why its the leading Web Server on the Internet.

Justin Freeman, 2004-02-08

Recent comments

Sebastian Botz on IoP – the internet of pets – predictive maintenance of a cat at 12:19
Daniel Kirstenpfad on IoP – the internet of pets – predictive maintenance of a cat at 20:41
Federico Hernandez on IoP – the internet of pets – predictive maintenance of a cat at 13:38
Steffen Nork on Dynamic Theme :: Tapetenwechsel at 12:34
Frank Köhler on Alles gut at 11:05
Ralf-Philipp Weinmann on Samsung Galaxy S10 :: Erste Eindrücke at 05:53
Ralf-Philipp Weinmann on Lenovo vs Apple laptops at 05:25
Volker Weber on Samsung in der Schepp Schachtel at 23:28
Lucius Bobikiewicz on Samsung in der Schepp Schachtel at 19:47
Volker Weber on Samsung in der Schepp Schachtel at 18:46
Jörg Weske on Samsung in der Schepp Schachtel at 18:25
Lucius Bobikiewicz on Samsung in der Schepp Schachtel at 17:44
Johannes Neubrecht on Samsung in der Schepp Schachtel at 16:23
Oliver Regelmann on The Hottest Chat App for Teens Is ... Google Docs :: The Atlantic at 15:47
Rob McDonagh on The Hottest Chat App for Teens Is ... Google Docs :: The Atlantic at 14:46
Gerhard Heeke on Dynamic Theme :: Tapetenwechsel at 10:25
Volker Weber on Dynamic Theme :: Tapetenwechsel at 20:10
Amy Blumenfield on Dynamic Theme :: Tapetenwechsel at 20:06
Volker Weber on Invoxia Triby :: Demnächst in diesem Theater at 16:21
Torben Volkmann on Invoxia Triby :: Demnächst in diesem Theater at 16:20
Volker Weber on You have to learn to live with Apple bugs at 12:00
Mike Hartmann on You have to learn to live with Apple bugs at 11:29
Peter Meuser on Headsets für Skype und Teams at 19:47
Dirk Rose on You have to learn to live with Apple bugs at 10:18
Chris Frei on Invoxia Pet Tracker :: Der Test beginnt at 08:19

Ceci n'est pas un blog

I explain difficult concepts in simple ways. For free, and for money. Clue procurement and bullshit detection.

vowe

Contact
Publications
Stuff that works
Amazon Wish List
Frequently Asked Questions

rss feed  twitter  amazon

Local time is 17:27

visitors.gif

buy me coffee

Paypal vowe