天空小小岛技术网站
标题:
iis7 rewrite 防盗链设置
[打印本页]
作者:
八号
时间:
2011-8-16 20:40
标题:
iis7 rewrite 防盗链设置
IIS7.0实现防盗链可以通过URL rewrite模块,将tkxxd.net改成你自己的域名然后保存为存为web.config,再将 web.config文件上传网站的根目录即可。如果已有web.config文件,只要将<rewrite>…</rewrite>这段代码添加到<system.webServer>和</system.webServer>之间。
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Forbid image">
<match url="\.(txt|doc|gif|jpg|jpeg|png|mp3|flv|swf)$" ignoreCase="false" />
<conditions>
<add input="{HTTP_REFERER}" pattern="^$" ignoreCase="false" negate="true" />
<add input="{HTTP_REFERER}" pattern="^http://(www\.)?tkxxd.net/.*$" negate="true" />
</conditions>
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
复制代码
如果显示默认图片则将
<action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />
复制代码
换成
<action type="Rewrite" url="/static/image/common/logo.png" />
复制代码
欢迎光临 天空小小岛技术网站 (http://tkxxd.net/)
Powered by Discuz! X3.1