我是第一次使用IIS Url重写。我安装了它,并使用IIS设置了一个规则,但当我尝试访问本地主机中的url时,没有任何反应。下面是IIS放入我的web.config中的内容。当我基于我设置的规则访问这个url mysite/srcc_development_2012/login/default.aspx,时,它应该重定向到google,但它不起作用。我遗漏了什么?
<rewrite>
<rules>
<rule name="SRCC" patternSyntax="Wildcard" stopProcessing="true">
<match url="mysite/srcc_development_2012/*" />
<action type="Redirect" url="http://www.google.com" />
<conditions logicalGrouping="MatchAny">
</conditions>
</rule>
</rules>
</rewrite>
发布于 2014-06-05 21:59:10
我知道这是一个较老的帖子,但它没有得到回答,并在搜索中显示出来。
下面是我如何做到这一点:
<rewrite>
<rules>
<rule name="SRCC" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<conditions>
<add input="{URL}" pattern="^srcc_development_2012(.*)?" />
</conditions>
<action type="Redirect" url="http://www.google.com" />
</rule>
</rules>
</rewrite>
中的值是域之后的值( stackoverflow.com / this / is / The -URL,其中stackoverflow.com是{HTTP_HOST} (但我们不将其用于此规则))。
发布于 2017-07-04 06:09:06
下面的代码应该可以用:
但请确保将此规则添加到登录文件夹中。
<rule name="redirect" stopProcessing="true">
<match url=".*" />
<action type="Redirect" url="https://google.com" />
</rule>
https://stackoverflow.com/questions/17457143
复制相似问题