简体   繁体   中英

IIS rewrite rule doesn't work

I want to simply to redirect Radio/Play?stationId=124 to station/124 but below configuration doesn't work. Other rules in my configuration works so rewrite modules working.

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

What is wrong in the configuration ?

Handling query string parameter is different. Here is correct way.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM