Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache mod_speling case insensitive URLs issue

I want to have case insensitive URLs using Apache's mod_speling module, but this is producing unwanted lists of "multiple options" whilst the Apache documention says

When set, this directive limits the action of the spelling correction to lower/upper case changes. Other potential corrections are not performed.

I'm testing this on an Apache 2.2.16 Unix fresh install but I'm still running into exact the same problems as submitted in 2008.

It's unexpected (and not wanted) behaviour when Apache lists a few "multiple choices" (status code 300) when the checkCaseOnly directive is on!

I have this in my httpd.conf:

CheckSpelling on
CheckCaseOnly on

First directive to use the mod_speling, second directive to limit only to case corrections

What am I doing wrong?

like image 677
Bart Avatar asked Aug 10 '10 14:08

Bart


4 Answers

TLDR: CheckCaseOnly is broken due to a bug that has remained unfixed for over six years as of 10/2014.

I know this is an old question, but I just ran into the same issue. This update is to help others with the same issue.

The current answers to this question are incorrect, as the OP is using mod_speling correctly, but there is a bug.

https://issues.apache.org/bugzilla/show_bug.cgi?id=44221

The underlying issue is that the apache people are in disagreement over fixing this behavior because it changes the rest of the module. This has remained unfixed for something like 6 years.

like image 134
user1647075 Avatar answered Oct 16 '22 21:10

user1647075


To enable mod_speling (either by Location or VirtualHost) use the directive:

CheckSpelling On

If all you want is case insensitivity use:

CheckCaseOnly On

You also need to have RewriteEngine enabled:

RewriteEngine On
like image 22
fijiaaron Avatar answered Oct 16 '22 21:10

fijiaaron


On Ubuntu 12.04 LTS using Apache 2.2, I did the following:

  1. Create speling.conf in ${APACHE}/mods-available to provide the config options.

    <IfModule mod_speling.c>
        CheckSpelling On
        CheckCaseOnly On
    </IfModule>
    
  2. Link speling.conf and speling.load into the enabled modules directory ${APACHE}/mods-enabled:

    # cd ../mods-enabled
    # ln -s ../mods-available/speling.conf speling.conf
    # ln -s ../mods-available/speling.load speling.load
    
  3. Restart the server.

    # service restart apache2
    
like image 30
icedwater Avatar answered Oct 16 '22 22:10

icedwater


After reading user1647075's answer about this being a known Apache bug that's unlikely to be fixed, I decided my best option was to hide the "multiple options" page from the user by updating my Apache config to show the 404 error page for 300 status codes:

ErrorDocument 300 /404.htm

Of course, you can also create a custom error page instead of reusing the 404 error page.

Hope this workaround helps.

like image 29
Sandra Avatar answered Oct 16 '22 21:10

Sandra