Exclude a directory from a rewriterule using ISAPI rewrite 3

Posted by mludd on Stack Overflow See other posts from Stack Overflow or by mludd
Published on 2010-04-19T17:12:47Z Indexed on 2010/04/19 17:13 UTC
Read the original article Hit count: 906

Filed under:
|
|
|

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?

© Stack Overflow or respective owner

Related posts about regex

Related posts about isapi-rewrite