Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[发布] iis7.5 配置web.config防盗链

[复制链接]
寒寺枯灯 发表于 2011-7-19 00:52:42 | 显示全部楼层 |阅读模式
本帖最后由 寒寺枯灯 于 2011-7-20 00:58 编辑

在网站根目录新建一个文件,命名为:web.config,输入以下内容:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Prevent hotlinking">
<match url="^.*\.(rar|zip)$" ignoreCase="true" />
<conditions>
<add input="{HTTP_REFERER}" pattern="http://www.fuqi800.com/.*" negate="true" />
<add input="{HTTP_REFERER}" pattern="http://sims.fuqi800.com/.*" negate="true" />
<add input="{HTTP_REFERER}" pattern="http://www.hudie.la/.*" negate="true" />
</conditions>
<action type="Rewrite" url="/404.htm" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

如已经有web.config文件则在
<configuration>
后面加入下面内容即可:
<system.webServer>
<rewrite>
<rules>
<rule name="Prevent hotlinking">
<match url="^.*\.(rar|zip)$" ignoreCase="true" />
<conditions>
<add input="{HTTP_REFERER}" pattern="http://www.fuqi800.com/.*" negate="true" />
<add input="{HTTP_REFERER}" pattern="http://sims.fuqi800.com/.*" negate="true" />
<add input="{HTTP_REFERER}" pattern="http://www.hudie.la/.*" negate="true" />
</conditions>
<action type="Rewrite" url="/404.htm" />
</rule>
</rules>
</rewrite>
</system.webServer>

文件中设置了只允许http://www.fuqi800.com、http://sims.fuqi800.com、http://www.hudie.la调用网站的rar、zip类型的文件,

若来源并非以上三个网站则网页返回至404.htm。对于图片等其他文件同样适用,可以根据自己的需要进行修改



www.xxsea.com 发表于 2011-7-19 09:40:17 | 显示全部楼层
支持.露过帮顶.
回复

使用道具 举报

artsharp 发表于 2011-7-19 09:48:31 | 显示全部楼层
支持.路过帮顶.
回复

使用道具 举报

nifengge 发表于 2011-7-19 10:29:13 | 显示全部楼层
IIS 6能用不
回复

使用道具 举报

wyymcy 发表于 2011-7-19 11:13:33 | 显示全部楼层
同LS问
回复

使用道具 举报

sbigeyid520 发表于 2011-7-19 11:18:10 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复

使用道具 举报

ilei365 发表于 2011-7-19 11:37:13 | 显示全部楼层
顶个。。。。。。。。
回复

使用道具 举报

marshal_nyb 发表于 2011-7-19 13:06:53 | 显示全部楼层

测试一下!
回复

使用道具 举报

marshal_nyb 发表于 2011-7-19 13:07:29 | 显示全部楼层
好像没用嘛
回复

使用道具 举报

riccilee 发表于 2011-8-13 13:42:42 | 显示全部楼层
好东西 支持!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-9-21 19:45 , Processed in 0.186572 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表