zoukankan      html  css  js  c++  java
  • IIS 下利用UrlRewriter做图片防盗链

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <staticContent>
                <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="365.00:00:00" />
            </staticContent>
            <rewrite>
                <rules>
            <rule name="RequestBlockingRule1" enabled="true" stopProcessing="true">
                <match url=".*" />
                <conditions>
                <add input="{HTTP_REFERER}" pattern="^$" negate="true" />
                <add input="{HTTP_REFERER}" matchType="Pattern" pattern="^http://(.*.)?(test.com)/.*$" ignoreCase="true" negate="true" />
                <add input="{HTTP_REFERER}" matchType="Pattern" pattern="^http://(.*.)?(fengzili.com)/.*$" ignoreCase="true" negate="true" />
                </conditions>
                <action type="CustomResponse" statusCode="404" />
            </rule>
                    <rule name="Readme" patternSyntax="ECMAScript" stopProcessing="true">
                        <match url="rm" />
                        <action type="Rewrite" url="readm2e.txt" />
                    </rule>
                </rules>
            </rewrite>
        </system.webServer>
    </configuration>

    上面的实例中只有用test.com和fengzili.com来访问这个网站的时候,资源才会正常显示。

    底下那个规则是把url中有rm的都映射到readm2e.txt文件中输出。

    强烈感谢  http://www.cnblogs.com/shuaixf/p/3414136.html 这个兄弟的代码,傻逼微软弄的这个东西,我自己配置好多遍死活不行,拷贝过来就可以了(环境:Windows2012 IIS7)

  • 相关阅读:
    bordersizing属性
    solr服务的搭建(以solr4.1实现)
    在网页标题栏title加入图标?
    JS中JSON对象的定义和取值
    eclipse搭建maven ssm项目
    用JAVA中BufferedImage画出漂亮的验证码点击变化
    Python环境变量搭建
    如何在目录ODP提交您的网站?
    PHP的301重定向代码
    VMware系统克隆
  • 原文地址:https://www.cnblogs.com/yanyuge/p/3967117.html
Copyright © 2011-2022 走看看