[英]IIS rewrite rule - invalid rule
I'm trying to convert some mod_rewrite rules to IIS 7.5 rules in my web.config 我正在尝试在我的web.config中将一些mod_rewrite规则转换为IIS 7.5规则
I'm having a problem with the following as IIS gives the error of - 我在以下方面遇到问题,因为IIS给出的错误-
"The expression "^(?!/(___generated|images)/.*$)" contains an escape sequence that is not valid." “表达式“ ^(?!/(___ Generated | images)/.*$)”包含无效的转义序列。
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 谢谢
Try to replace _\\_\\_
with underscores only. 尝试仅用下划线替换
_\\_\\_
。 Underscore is not a special character and does not need to be escaped with a backslash. 下划线不是特殊字符,不需要用反斜杠转义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.