[英]Exceptions in redirection in URL in IIS Rewrite module are ignored
I have a new site https://www.NewSite.com and I would like all the traffic to my old site https://www.OldSite.com to be redirected to the root of my new site https://www.NewSite.com/ , with some exception. 我有一个新站点https://www.NewSite.com ,我希望所有到我旧站点https://www.OldSite.com的流量都重定向到我新站点https:// www的根目录。 NewSite.com/ ,但有一些例外。
For instance I would like the URL (among others) https://www.OldSite.com/noredirect not to be redirected and others to be rewritten. 例如,我希望不要重定向URL(除其他外) https://www.OldSite.com/noredirect ,而要重写其他URL。 For instance: 例如:
Therefore I wrote two rules in my Old Site site in IIS: 因此,我在IIS的旧站点站点中编写了两个规则:
<rewrite>
<rules>
<clear />
<rule name="Rewrite To New Site" stopProcessing="true">
<match url="/kb(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Rewrite" url="https://www.newsite.com/kb" />
</rule>
<rule name="Redirect to New Site" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_URI}" pattern="(.*)/noredirect$" negate="true" />
</conditions>
<action type="Redirect" url="https://www.newsite.com" appendQueryString="false" />
</rule>
</rules>
</rewrite>
This rules just redirect all the requests to my old site to the root of my new site, ignoring the exceptions and the rewrite rule. 此规则只是将对我的旧站点的所有请求重定向到新站点的根目录,而忽略异常和重写规则。 The same happens with: 同样的情况发生在:
<rule name="Redirect to New Site" stopProcessing="true">
<match url="(.*)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{REQUEST_URI}" pattern="^/noredirect(.*)" negate="true" />
</conditions>
<action type="Redirect" url="https://www.newsite.com" appendQueryString="false" />
</rule>
What am I doing wrong? 我究竟做错了什么?
Make sure you've checked "Enable proxy" under Application Request Routing cache. 确保已选中“应用程序请求路由”缓存下的“启用代理”。 You can find some information about it here: http://www.iis.net/learn/extensions/configuring-application-request-routing-%28arr%29/creating-a-forward-proxy-using-application-request-routing 您可以在这里找到有关它的一些信息: http : //www.iis.net/learn/extensions/configuring-application-request-routing-%28arr%29/creating-a-forward-proxy-using-application-request-路由
Good luck! 祝好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.