Admin-Ahead Community

Linux => General Linux => Topic started by: vinayakk on January 04, 2014, 03:53:59 am

Title: Case insensitive url with mod_speling in Apache
Post by: vinayakk on January 04, 2014, 03:53:59 am
If you want requested URLs to be valid whether uppercase or lowercase letters are used and with one spelling mistake, “mod_speling” module needs to be enabled in apache.

The mod_speling module is part of the standard Apache distribution but is not enabled by default, so you need to explicitly enable it. When mod_speling is installed, it may be turned on for a particular scope (such as a directory, virtual host, or the entire server) by setting the CheckSpelling directive to On.

For making URL case-insensitive in cPanel:

Download the apache source

# cd /opt/httpd-2.4.7/modules/mappers
# /usr/local/apache/bin/apxs -c mod_speling.c
# /usr/local/apache/bin/apxs -i -a -n speling mod_speling.so

Add the below line in the conf file if does not exist.

LoadModule speling_module modules/mod_speling.so

Then add "CheckSpelling on" into the VirtualHost section of httpd.conf

In Cpanel based server, first run:
 
/scripts/easyapache

 And select ‘Speling’ from the available module list for apache. Once apache/php are recompiled with this option and easyapache finishes, you can put below code in the .htaccess or in the virtual host entry of the particular domain to apply it to any directory/directories :

< IfModule mod_speling.c > 
CheckSpelling On
CheckCaseOnly On
< / IfModule >

 :)