0

I'm trying to convert some mod_rewrite rules to IIS 7.5 rules in my web.config

I'm having a problem with the following as IIS gives the error of -

"The expression "^(?!/(___generated|images)/.*$)" contains an escape sequence that is not valid."

The rule is:

<rule name="Imported Rule 2" stopProcessing="true">
  <match url="^(.*[A-Z].*)$" ignoreCase="false" />
  <conditions>
    <add input="{HTTP_HOST}" pattern="(.*)" ignoreCase="false" />
    <add input="{URL}" pattern="^(?!/(\_\_\_generated|images)/.*$)" ignoreCase="false" />
  </conditions>
  <action type="Redirect" redirectType="Permanent" url="http\://{C:1}{R:1}" />
</rule>

Any help would be appreciated and yes I need to brush up on my regex!

Thanks

4

1 回答 1

1

尝试_\_\_仅用下划线替换。下划线不是特殊字符,不需要用反斜杠转义。

于 2013-10-31T13:14:59.120 回答