我想删除www。来自所有请求,并将所有来自.info域的请求重定向到.com域,除了主页和其他一些网址,例如/ usefulldoc /,但它不适用于第二条规则。 这是我在web.config中的规则:
<rules>
<rule name="Remove WWW" stopProcessing="true">
<match url=".*" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^www\.(.*)$" />
</conditions>
<action type="Redirect" url="http://{C:1}/{R:0}" appendQueryString="true" redirectType="Permanent" />
</rule>
<rule name="Redirect .info to .com with some Exceptins" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="example\.info$" negate="true" ignoreCase="true" />
<add input="{HTTP_HOST}" pattern="example\.info(.*)$" ignoreCase="true"/>
<add input="{REQUEST_URI}" pattern="^(.*)/usefulldoc(.*)$" negate="true" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://example.com/{R:1}" appendQueryString="true" />
</rule>
</rules>