IIS重写规则来修改url

时间:2015-10-08 08:51:48

标签: asp.net iis url-rewriting

以下是示例网址:

http://localhost/myapp/images/Loading/bandwidth_States.png

我想重写为:

http://localhost/myapp/images/Loading/bandwidth_States.png?ver=20131014

1 个答案:

答案 0 :(得分:0)

我找到了答案:

在web.config中:

<system.webServer>
  <rewrite>
  <rules>
    <rule name="Image Versioning">
      <match url="(.*).png" />
        <action type="Rewrite" url="{R:0}" appendQueryString="true" />
        <conditions>
            <add input="{QUERY_STRING}" pattern="ver=20140320" negate="true" />
        </conditions>
    </rule>
  </rules>
</rewrite>
</system.webServer>