Url rewriting URL重写规则,用于删除除1之外的所有URL的www
我有一个工作规则,删除所有进入的URL的www。我有一个网站,重定向将从POST更改为GET。我需要从该规则中排除URL 我已经研究过其他解决方案,但没有成功Url rewriting URL重写规则,用于删除除1之外的所有URL的www,url-rewriting,iis-7.5,Url Rewriting,Iis 7.5,我有一个工作规则,删除所有进入的URL的www。我有一个网站,重定向将从POST更改为GET。我需要从该规则中排除URL 我已经研究过其他解决方案,但没有成功 <rewrite> <rules> <rule name="Remove WWW" enabled="true" stopProcessing="true"> <match url=".*"/> &l
<rewrite>
<rules>
<rule name="Remove WWW" enabled="true" stopProcessing="true">
<match url=".*"/>
<conditions>
<add input="{HTTP_HOST}" pattern="^(www\.)(foo\.net)" />
</conditions>
<action type="Redirect" url="https://{C:2}/{R:1}" />
</rule>
</rules>
</rewrite>
您可以通过向“不匹配”(也称为添加“negate='true')添加一个条件轻松做到这一点,类似这样的操作应该会起作用:
<rules>
<rule name="Remove WWW" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www\.foo\.net$" />
<add input="{URL}" pattern="^/WebServices/service\.asmx$" negate="true" />
</conditions>
<action type="Redirect" url="https://foo.net/{R:1}" />
</rule>
</rules>