当前位置:SEO自学网 > 网站搭建 > 网站建设 > apache、iis6、ii7独立ip主机设置防盗链(适用vps云主机服务器)

apache、iis6、ii7独立ip主机设置防盗链(适用vps云主机服务器)

admin2022年05月04日 13:02:36网站建设322

若是安装了我司助手环境请先按http://www.west.cn/faq/list.asp?unid=650 把伪静态组件开启

若是纯净版系统,请按http://www.west.cn/faq/list.asp?unid=639 把伪静态组件开启

然后在配置文件中按以下系统规则配置

apache和iis6实现防盗链规则相同:

进入others/httpd.conf中,保留前两行,复制以下规则保存即可

RewriteEngine on

RewriteCond %{HTTP_REFERER} !baidu.com [NC]

RewriteCond %{HTTP_REFERER} !google.com [NC]

RewriteCond %{HTTP_REFERER} !xxx.net [NC]

RewriteCond %{HTTP_REFERER} !^$ [NC]

RewriteRule .*\.(gif|jpg)$ /band.txt [NC,L]

xxx.net是您自己的域名

band.txt是被盗链后的提示内容文件

iis7实现防盗链:

在网站根目录wwwroot下创建一个web.config文件,复制以下代码保存即可, 如果网站有设置伪静态,已存在web.config,则只复制中间颜色部分代码,加到第一个<rules>之后即可

<?xml version="1.0" ?>

<configuration>

<system.webServer>

<rewrite>

<rules>

<rule name="Prevent hotlinking">

<match url="^.*\.(rar|zip|jpg|gif)$" ignoreCase="true" />

<conditions>

<add input="{HTTP_REFERER}" pattern="http://www.xxxxxx.com/.*" negate="true" />

<add input="{HTTP_REFERER}" pattern="http://xxxxxx.com/.*" negate="true" />

<add input="{HTTP_REFERER}" pattern="^$" negate="true" />

</conditions>

<action type="Rewrite" url="/404.html" />

</rule>

</rules>

</rewrite>

</system.webServer>

</configuration>

来源:西部数码


扫描二维码推送至手机访问。

版权声明:本文由SEO自学网发布,如需转载请注明出处。

本文链接:http://www.seozixuewang.com/post/3664.html

标签: 防盗链

“apache、iis6、ii7独立ip主机设置防盗链(适用vps云主机服务器)” 的相关文章

IIS通过URL重写实现防盗链2022年04月23日 19:32:05