IIS7.5配置防盗链

  • A+
所属分类:Windows

1、下载微软自己提供的IIS REWRITE模块:http://www.microsoft.com/downloads/zh-cn/details.aspx?familyid=1b8c7bd8-8824-4408-b8fc-49dc7f951a00
2、修改网站的web.config

引用
    <system.webServer>
<rewrite>
<rules>
<rule name="Prevent hotlinking">
<match url="^.*\.(rar|zip)$" ignoreCase="true" />
<conditions>
<add input="{HTTP_REFERER}" pattern="http://www.zxar520.com/.*" negate="true" />
<add input="{HTTP_REFERER}" pattern="http://wt.zxar520.com/.*" negate="true" />
</conditions>
<action type="Rewrite" url="/no.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
设置了只允许http://www.zxar520.comhttp://wt.zxar520.com调用网站的rar、zip类型的文件。

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: