About nixCraft

Topics

Linux: Forcing Apache to correct misspellings of URL

Posted by Vivek Gite [Last updated: July 28, 2005]

Apache has mod_speling for automatic URL spell-correction. For example when on this site you can request the page using following format:

http://cyberciti.biz/news is same as use URL http://cyberciti.biz/news.php.

This module help visitor to get correct content instead of error 404 – document not found and you can also omit file extension such as .pl, .php, .html etc in urls references. It attempts to correct misspellings of URLs that users might have entered, by ignoring capitalization and by allowing up to one misspelling. This must be configured on massive web hosting server by ISP and web hosting service providers so the hosting customer can take advantage of this module.

Following steps demonstrates how to activate this module under Debian GNU/Linux:

A) Open your Apache modules configuration file:
# vi /etc/apache-perl/modules.conf

B) Append following line to this file:
LoadModule speling_module /usr/lib/apache/1.3/mod_speling.so

C) Save the file.

D) This module need to be configured via httpd.conf via CheckSpelling directive. You can configure it for entire site, particular virtual host or even via .htaccess file. Open your /etc/apache-perl/httpd.conf and add followint line in server config context:

CheckSpelling on

E) Restart the apache:
# /etc/init.d/apache-perl restart

Please note that above steps are same under FreeBSD/Solaris for Apache web server except for file location i.e. httpd.conf and modules.conf. Please refer man page for more info.

Tell us how we're doing: Please answer a few questions about your experience to help us improve nixCraft.

You may also be interested in other helpful articles:

Discussion on This Article:

  1. Anonymous Says:

    This is good now i can use almos omit the file extensions :D
    However page http://httpd.apache.org/docs/2.0/mod/mod_speling.html points that “the directory scan which is necessary for the spelling correction will have an impact on the server’s performance when many spelling corrections have to be performed at the same time”

    What you think of this?

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2004-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.