开发者

Exclude a directory from a rewriterule using ISAPI rewrite 3

开发者 https://www.devze.com 2022-12-27 04:54 出处:网络
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.

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 who开发者_开发问答le dance?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号