新梦想网络 > 客服中心 > 虚拟主机问题 > 正文缩放字号: [收藏本问题]

如何设置防盗链(win2008iis7)

时间:2013-05-23来源:蓝木网络 作者:蓝木网络 点击:
今天讲一下:如何设置防盗链(win2008iis7)

首先我们需要用记事本制作一个web.config,记住将*txt格式改为.config  代码如下:




   <system.webServer>  

    <rewrite>  
    <rules>  
    <rule name="Prevent hotlinking">  
    <match url="^.*\.(rar|zip|jpg|gif)$" ignoreCase="true" />  
    <conditions>  
    <add input="{HTTP_REFERER}" pattern="
http://www.lanmun.com/.*" negate="true" />  
    <add input="{HTTP_REFERER}" pattern="
http://lanmun.com/.*" negate="true" />  
    </conditions>  
    <action type="Rewrite" url="/404.html" />  
    </rule>  
    </rules>  
    </rewrite>  
    </system.webServer> 


   以上代码是允许了www.lanmun.comlanmun.com对rar|zip|jpg|gif文件进行调试

将以上文件上传至网站根目录(wwwroot)下即可 如果网站有设置伪静态,直接将上述代码加入原有web.config一样可以生效

 

    TAG:

    下载此文章 (欢迎转载,请注明出处:http://www.xmxwl.net/help/host/20130523/13071.html)