Forum Moderators: coopster & phranque

Message Too Old, No Replies

case-insensitive with mod_rewrite

One of my wishes: understanding regex :)

         

st2xo

9:35 am on Jun 14, 2002 (gmt 0)

10+ Year Member



Hi,

I´m searching for a mod_rewrite rule to make my folders and filename case insensitive.

In thousands of html files are thousands <img src>es and <a href>s with case-sensitive folder- and filenames from a frontpage(argh!)-guy

And now I have to fix it. The best would be to use mod_rewrite I think. But I never was a mod_rewrite-guru ... (I dont want to process the folders with an regex, because the mod_rewrite could be helpful in another folders)

Could anybody give me a hint or a complete rule? :-)

Thanks very very much!!!!

st2xo

bird

2:08 pm on Jun 14, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I haven't tested this, but assuming that all your physical directory and file names are in lowercase, you could try the following, which uses one of the builtin mapping function in the substitution pattern:

RewriteEngine On

RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule ^(.*)$ ${tolower:$1}

<added>If your files and folders aren't all in lower case, then read this thread [webmasterworld.com] ;)</added>