龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > 操作系统 > Windows系统 > 服务器 >

IIS URL Rewrite Module防盗链规则配置方法

时间:2014-06-11 16:19来源:网络整理 作者:网络 点击:
分享到:
这篇文章主要介绍了IIS URL Rewrite Module防盗链规则配置方法,大家参考使用吧

IIS版本:IIS 7.5

URL Rewrite组件:IIS URL Rewrite Module(http://www.iis.net/downloads/microsoft/url-rewrite)

规则定义截图:
Web.config中的规则定义:

代码如下:

<rewrite>
    <rules>
        <rule name="RequestBlockingRule1" enabled="true" stopProcessing="true">
            <match url=".*" />
            <conditions>
                <add input="{HTTP_REFERER}" pattern="^$" negate="true" />
                <add input="{HTTP_REFERER}" pattern="^http://(.*\.)?(cnblogs\.com)/.*$" negate="true" />
            </conditions>
            <action type="CustomResponse" statusCode="404" />
        </rule>
    </rules>
</rewrite>

精彩图集

赞助商链接