views:

223

answers:

1

Basically I've recently added the below rule in my httpd.conf for ISAPI rewrite on an IIS server to make sure that it always defaults to lower-case file and directory names.

RewriteRule ^(.*[A-Z].*)$ $1 [CL,R=301,L]

This is all fine and dandy for every part of the site except for one directory which we can call /MisbehavingDir, the code in this particular directory is filled with mixed-case filenames and lots of server- and client-side scripting that would have to be rewritten to use all lower-case in order to work properly (with the RewriteRule above it seems to hit a couple of 301s in the wrong places which causes that part of the site to function poorly to say the least).

Since I'm not in the mood for rewriting that part of the site I'd love to find a good way to modify the above regex so that it matches everything except paths starting with MisbehavingDir and since my regex-fu isn't really good enough I figured I'd ask here.

Is there a simple "beautiful" solution to this that anyone wants to share or should I just set aside several days to rewrite the app, then test it and go through that whole dance?

A: 

Well, apparently the trick was to add a rewritecond statement that looks something like RewriteCond %{URL} ^(?!/MisbehavingDir/.*$) to make ISAPI rewrite skip the next rule.

mludd