简体   繁体   English

IIS重写规则以修改URL

[英]IIS rewrite rules to modify the url

Following is the sample url: 以下是示例网址:

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

which I want to rewrite to: 我想重写为:

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

I found the answer: 我找到了答案:

In web.config: 在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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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