【问题标题】:IIS rewrite rule doesn't workIIS 重写规则不起作用
【发布时间】:2014-12-04 10:13:30
【问题描述】:

我只想将 Radio/Play?stationId=124 重定向到 station/124 但以下配置不起作用。我的配置中的其他规则有效,因此重写模块有效。

<rule name="radio-play" stopProcessing="true">
   <match url="^Radio/Play?stationId=([0-9]+)" ignoreCase="true" />
   <action type="Redirect" url="station/{R:1}" redirectType="Permanent" />
</rule>

配置有什么问题?

【问题讨论】:

  • 有人有什么想法或线索吗?

标签: asp.net iis url-rewriting


【解决方案1】:

处理查询字符串参数不同。这是正确的方法。

    <rule name="radio-play" stopProcessing="true">
      <match url="^radio/play" ignoreCase="true" />
      <conditions>
        <add input="{QUERY_STRING}" pattern="stationid=(\d+)"  ignoreCase="true"/>
      </conditions>
      <action type="Redirect" url="istasyon/{C:1}" redirectType="Permanent"  appendQueryString="false"/>
    </rule>

【讨论】:

    猜你喜欢
    • 2018-04-12
    • 1970-01-01
    • 1970-01-01
    • 2015-07-10
    • 2017-03-08
    • 2013-08-14
    • 2020-01-18
    • 1970-01-01
    相关资源
    最近更新 更多