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

Robert Schneider on Typ-2-Diabetes lässt sich wohl wieder zurückdrängen #dontbreakthechain at 18:28
Armin Grewe on Yancey Strickler :: The Internet is Becoming a Dark Forest at 17:44
Till Nachtmann on Yancey Strickler :: The Internet is Becoming a Dark Forest at 16:33
Volker Weber on Yancey Strickler :: The Internet is Becoming a Dark Forest at 15:22
Volker Weber on If you build barriers, people will build around you. If you are lucky. at 15:07
Armin Grewe on Yancey Strickler :: The Internet is Becoming a Dark Forest at 11:28
Theo Heselmans on If you build barriers, people will build around you. If you are lucky. at 11:13
Tim Oliver Spielmann on Ladeprobleme mit dem Apple Smart Battery Case at 09:00
Maikel Maes on Externe SSD mit USB-C für aktuell 88 Euro at 00:38
Volker Weber on Yet another butterfly for Apple at 20:58
Bernd Hofmann on Yet another butterfly for Apple at 19:24
Volker Weber on If you build barriers, people will build around you. If you are lucky. at 18:40
Jochen Kattoll on How to find text on a page in iOS Safari at 17:53
Christian Ott on Dark mode? Light mode. at 15:49
Ingo Seifert on How to find text on a page in iOS Safari at 14:35
Ben Langhinrichs on If you build barriers, people will build around you. If you are lucky. at 14:33
Volker Weber on Externe SSD mit USB-C für aktuell 88 Euro at 13:43
Martin Kautz on Externe SSD mit USB-C für aktuell 88 Euro at 11:49
Volker Weber on Externe SSD mit USB-C für aktuell 88 Euro at 11:35
Marc Beckersjuergen on Externe SSD mit USB-C für aktuell 88 Euro at 11:34
Martin Kautz on How to find text on a page in iOS Safari at 10:56
Horia Stanescu on How to find text on a page in iOS Safari at 10:38
Thomas Cloer on Dark mode? Light mode. at 10:35
Markus Mews on How to find text on a page in iOS Safari at 08:55
Oliver Regelmann on How to find text on a page in iOS Safari at 08:23

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 01:44

visitors.gif

buy me coffee

Paypal vowe