Windows 2008R2 IIS7.5配置防盗链方法
时间:2022-01-12 19:29:18
小编:斜杆下载
Windows 2008R2 IIS7.5配置防盗链方法
1、下载微软自己提供的IIS REWRITE模块:http://www.microsoft.com/downloads/zh-cn/details.aspx?familyid=1b8c7bd8-8824-4408-b8fc-49dc7f951a002、修改网站的web.config
引用
<system.webServer>
<rewrite>
<rules>
<rule name="Prevent hotlinking">
<match url="^.*.(rar|zip)$" ignoreCase="true" />
<conditions>
<add input="{HTTP_REFERER}" pattern="http://www.xggww.com/.*" negate="true" />
<add input="{HTTP_REFERER}" pattern="http://soft.xggww.com/.*" negate="true" />
</conditions>
<action type="Rewrite" url="/no.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
<rewrite>
<rules>
<rule name="Prevent hotlinking">
<match url="^.*.(rar|zip)$" ignoreCase="true" />
<conditions>
<add input="{HTTP_REFERER}" pattern="http://www.xggww.com/.*" negate="true" />
<add input="{HTTP_REFERER}" pattern="http://soft.xggww.com/.*" negate="true" />
</conditions>
<action type="Rewrite" url="/no.html" />
</rule>
</rules>
</rewrite>
</system.webServer>
设置了只允许http://www.xggww.com、http://soft.xggww.com/ 调用网站的rar、zip类型的文件。