• rewrite2.0 设置防盗链,iis7.0+


    IIS7.0可以通过URL rewrite模块实现防盗链,复制下面的代码,将zdzz.net改成你自己的域名然后保存为存为web.config,再将 web.config文件上传网站的根目录即可。如果已有web.config文件,只要将<rewrite>…</rewrite>这段代码添加到<system.webServer>和< /system.webServer>之间。

    01 <?xml version="1.0" encoding="UTF-8"?>
    02 <configuration>
    03         <system.webServer>
    04             <rewrite>
    05                <rules>
    06                  <rule name="Forbid image">
    07                    <match url="\.(txt|doc|gif|jpg|jpeg|png|mp3|flv|swf)$" ignoreCase="false" />
    08                       <conditions>
    09                        <add input="{HTTP_REFERER}" pattern="^$" ignoreCase="false" negate="true" />
    10                        <add input="{HTTP_REFERER}" pattern="^http://(www\.)?fenggefushi.com/.*$" negate="true" />
    11                       </conditions>
    12                     <action type="Rewrite" url="/wp-content/uploads/forbid.png" />
    13                   </rule>
    14                </rules>
    15           </rewrite>
    16      </system.webServer>
    17  </configuration>

    如果你想让盗链你的图片的网站上显示你准备的"禁止盗链“之类的图片,请将


    1 <action type="CustomResponse" statusCode="403" statusReason="Forbidden" statusDescription="Forbidden" />

    换成


    1 <action type="Rewrite" url="/images/nohotlinking.jpg" />

    images/nohotlinking.jpg根据你实际的图片位置和名称做修改。

  • 相关阅读:
    python项目打包成exe
    sql同比环比计算
    七款好看文字样式纯css
    一站式智能芯片定制技术
    实战清除电脑上恶意弹出广告窗口
    GAAFET与FinFET架构
    MIPI多媒体接口
    Intel GPU实现游戏与数据中心
    芯片倒爷赚钱术
    Cache Memory技术示例
  • 原文地址:https://www.cnblogs.com/buaaboyi/p/2052263.html
Copyright © 2020-2023  润新知