1. 首页>>站长资讯

apache、iis规则设置防盗链

Linux下规则文件.htaccess(手工创建.htaccess文件到站点根目录)

<IfModule mod_rewrite.c>

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|png|css|js)$ /band.txt [NC,L]

</IfModule>

注:xxx.net是您自己的域名,band.txt是被盗链后的提示内容文件

Windows2008、2012或更高系统下规则文件web.config (手工创建web.config文件到站点根目录)

<?xml version="1.0" ?>

<configuration>

<system.webServer>

<rewrite>

<rules>

<rule name="rule1" stopProcessing="true">

<match url="^.*\.(css|js|gif|png|jpg|jpeg)$" ignoreCase="true" />

<conditions>

<add input="{HTTP_REFERER}" pattern="您的域名.com(不用加www)" negate="true" />

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

</conditions>

<action type="AbortRequest" />

</rule>

</rules>

</rewrite>

</system.webServer>

</configuration>

apache、iis屏蔽限制ip访问(适用虚拟主机)

apache、iis规则屏蔽拦截蜘蛛抓取

来源:西部数码


本文由网络搜索发布,不代表本站立场,如有侵权请联系站长删除。

投稿信箱

956558536@qq.com

文档附件24小时内上线

内容不反对人民不反对党