Login or e-mail Password   

Using Apache

Rate:
0

ratings: 0   
Views: 315

(This article is Part 2 in a series about Apache’s loadable modules. The previous topic was mod_ext_filter).

As former Microsoft-ite who made the leap to OSS, one of the things that took a little getting used to with Apache are that filenames are case-sensitive. While that’s long since been hammered into my soul, a great many other people browsing the web aren’t aware that some webservers are case-senstive, while others are not. Sometimes I’ll see “http://www.example.com/signup” in my access logs when what the person really wanted is “http://www.example.com/Signup”. I could easily catch these simple typos with a mod_rewrite rule, but what if the user entered “http://www.example.com/Sign-up” or “http://www.example.com/Signpu”? Trying to plan for the ways a URL could be miscontrued would be make for a lot of ugly mod_rewrite rules. A better choice is to load Apache’s mod_speling module.

Mod_speling is very easy to implement. And what’s more, unlike mod_ext_filter, it can be used from within an .htaccess file–shared hosting users rejoice! The module is normally loaded by default (though spell-checking is disabled), but you might want to double-check Apache’s http.conf:

LoadModule speling_module modules/mod_speling.so

Enabling mod_speling is as easy as:

<IfModule mod_speling.c>
CheckSpelling on
</IfModule>

A couple of points to remember:

  • mod_speling will only catch and correct up to one URL misspelling at a time. For true fuzzy matching you’ll have to use a more advanced solution.
  • If Apache finds several likely matching URLs, the user will be presented with a list to pick from.
  • Renaming files and not updating links, relying upon mod_speling to automagically fix them, isn’t a great idea. The module does a directory scan each time it intercepts a 404. If you have a lot misspelled files and a lot of pageviews, you will experience a noticable performance degradation.

For more information, check out the official Apache docs.



Read other articles from category: Technology





No messages


Add your opinion
You must be logged in to write a comment. If you're not a registered member, please register. It takes only few seconds, and you get an access to additional functions .
Rate article:
 
Author
Article
Additional information
Groups




About EIOBA
Articles
Explore
Publish
Community
Statistics
Users online: 203
Comments: 564
Articles: 65.266
EIOBA World

© 2005-8 EIOBA group. All rights reserved