Pur*_*ome 5 iis rewrite iis-7.5
我的 IIS7.5 站点有很好的重写模块。
现在,我希望添加一些 URL,它们都进入 HTTP 410-Gone 状态。
例如。
<rule name="Old Site = image1" patternSyntax="ExactMatch" stopProcessing="true">
<match url="image/loading_large.gif"/>
<match url="image/aaa.gif"/>
<match url="image/bbb.gif"/>
<match url="image/ccc.gif"/>
<action type="CustomResponse" statusCode="410"
statusReason="Gone"
statusDescription="The requested resource is no longer available" />
</rule>
Run Code Online (Sandbox Code Playgroud)
但这是无效的 - 网站没有开始说有重写配置错误。
还有另一种方法可以做到这一点吗?我并不特别想为每个URL定义一个 URL 和 ACTION 。
您需要匹配每个请求,然后使用条件将其过滤为您的特定 URL:
<rule name="Old Site = Image1" stopProcessing="true">
<match url="^(.*)$" />
<conditions logicalGrouping="MatchAny">
<add input="{REQUEST_URI}" pattern="^(.*)image/aaa.gif$" />
<add input="{REQUEST_URI}" pattern="^(.*)image/bbb.gif$" />
<add input="{REQUEST_URI}" pattern="^(.*)image/ccc.gif$" />
</conditions>
<action type="CustomResponse" statusCode="410" statusReason="Gone" statusDescription="The requested resource is no longer available" />
</rule>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
5857 次 |
最近记录: |