【问题标题】:IIS URL Rewrite - IIS 7IIS URL 重写 - IIS 7
【发布时间】:2013-07-01 16:23:57
【问题描述】:

我是使用 IIS Url Rewrite 的新手。我安装了它并使用 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>

【问题讨论】:

    标签: url iis rewrite


    【解决方案1】:

    我知道这是一个较旧的线程,但它没有得到答复并显示在搜索中..

    我会这样做:

    <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>
    

    in 中的值是域之后的值(stackoverflow.com/THIS/IS/THE-URL,其中 stackoverflow.com 是 {HTTP_HOST}(但我们没有将其用于此规则))。

    【讨论】:

      【解决方案2】:

      下面的应该可以工作:

      但请确保将此规则添加到登录文件夹。

      <rule name="redirect" stopProcessing="true">
            <match url=".*" />
            <action type="Redirect" url="https://google.com" />
      </rule>
      

      【讨论】:

        猜你喜欢
        • 2014-05-01
        • 2012-12-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-10-09
        • 2012-10-29
        • 2011-08-18
        相关资源
        最近更新 更多