Solved

mod_rewrite and mod_speling not working together

Posted on 2006-07-06
1
1,400 Views
Last Modified: 2011-03-03
I have a site where mod_rewrite is needed for a custom php framework.   The site in question is being transfered from a windows server using ASP to a linux server and will be converted to php.  On the windows server the files could called with case insensitivity.  I'm trying to duplicate this because a lot of links on the site don't match to the exact case of some of the folders or filenames.  (we didn't build the site, we're just tranfering it, and I don't know why the original developer did that.)

I enabled mod_speling but if mod_rewrite is on with our rules, it doesn't work.  If I take out our mod_rewrite rules, then mod_speling works as it's supposed to.  I understand why this happens.  Our rewrite rules have conditions that state that if the REQUEST_FILENAME is not a file or directory then execute the rule.  

I don't know if it's possible, but can mod_speling and mod_rewrite play nice and work together?

Here's the information in our .htaccess file for mod_speling and mod_rewrite.

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

<IfModule mod_rewrite.c>
    RewriteEngine On
         
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f    
    RewriteRule ^(control)$ admin.php?use=yes [L,NC]
   
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f    
    RewriteRule ^(control/)(.*)$ admin.php?use=yes&url=$2 [L]
   
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ frontend.php?use=yes&url=$1 [L]    
</IfModule>

Thank you.
0
Comment
Question by:purfus
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
ID: 17057004
I guess mod_spelling is a bad idea for something like you have: "a lot of links on the site don't match to the exact case of some of the folders or filenames"
This sounds like you may have files like:
  Foo.baR
  fOO.Bar
  foo.bar
and so on ...
in that case mod_spelling gets confused too.

I'd clean up your filenames, for example use only lower case.
First search for "duplicates" as I described above, and make a decision how to rename them.
Then convert all filenames to lower case:
   find . -type f -name \*.xxx -exec perl -e '$f=$ARGV[0];rename$f,lc($f);' {} \;

then you cann use a simple rewrite rule:

RewriteMap lc int:tolower
RewriteRule ^/(.*) ${lc:$1}
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question