【问题标题】:IIS rewrite .jpg to .ashxIIS 将 .jpg 重写为 .ashx
【发布时间】:2018-08-18 14:08:14
【问题描述】:

【问题讨论】:

  • 你有没有看过重写的结果是什么?
  • 将改写规则​​改成重定向,就可以轻松查看改写结果。并且查询字符串不是路径的一部分,因此它不会与您的 * 匹配,您应该在规则中使用“传递查询字符串”属性

标签: asp.net iis url-rewrite-module


【解决方案1】:

你的重写应该是:

<rule name="image.jpg rewrite" stopProcessing="true">
    <match url="^image.jpg$" />
    <action type="Rewrite" url="/image.ashx" />
</rule>

这部分^image.jpg$将匹配所有对image.jpg的请求

这部分&lt;action type="Rewrite" url="/image.ashx" /&gt;会重写为image.ashx。

您不需要使用{R:1},因为默认情况下,重写模块会将所有查询字符串附加到默认情况下进行重写。

【讨论】:

    猜你喜欢
    • 2021-06-05
    • 1970-01-01
    • 2014-10-15
    • 1970-01-01
    • 2022-01-17
    • 1970-01-01
    • 2013-08-16
    • 1970-01-01
    • 2013-12-01
    相关资源
    最近更新 更多