NYCPHP Meetup

NYPHP.org

[nycphp-talk] Case-insensitive option for unix web hosting

Dan Cech dcech at phpwerx.net
Fri Jan 14 15:51:27 EST 2011


On 1/14/2011 3:33 PM, Chris Snyder wrote:
> Not strictly a php question, though perhaps that's the way to solve it...
>
> I'm working with an organization that wants to leave their Windows
> hosting behind, but their site is full of inconsistently cased
> links.... meaning, they have pages that link to /aboutus/index.htm but
> the file on disk is /AboutUs/index.htm
>
> Aside from slapping my forehead for taking this on, is there a
> shortcut, an Apache module or configuration, or some other easy way I
> can fake a case-insensitive filesystem on a unix (Linux) box?

If you change all the filenames on disk to lower case, you can cheat a 
little and rewrite all URLs to lower case with:

RewriteEngine on
RewriteMap lowercase int:tolower
RewriteCond $1 [A-Z]
RewriteRule ^/(.*)$ /${lowercase:$1} [R=301,L]

Good Luck!

Dan



More information about the talk mailing list