You are here

Use mod_speling to fix mis-typed URIs

I just discovered the Apache module mod_speling (yup, one 'l') which is a fantastic way to ensure visitors who mistype URIs get automatically redirected to the correct location.

If mod_speling is compiled on your (Apache only) web server, and you can make config changes using htaccess, the you can add the following lines to your htaccess file to fix mis-spellings:

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

The ifmodule directive ensures that you won't cause errors on your site if the module is not installed and helps makes your code more portable. Checkspelling On is the directive enabling spell checking, although webmonkey thinks it's SpellCheck on which didn't work for me.

It's now in action on this site, and from an initial evaluation seems pretty nifty. https://andylangton.co.uk/tuff/ becomes https://andylangton.co.uk/stuff/ just as https://andylangton.co.uk/raticles/ becomes https://andylangton.co.uk/articles/. Which, sad as it may be, impresses me greatly.

I'll update this article if I notice anything interesting about the module.