apache、iis规则设置防盗链

网站建设 2022-07-27 13:01www.1681989.com免费网站

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

<IfModule mod_rewrite.c>

RewriteEnge on

RewriteCond %{HTTP_REFERER} !baidu. [NC]

RewriteCond %{HTTP_REFERER} !google. [NC]

RewriteCond %{HTTP_REFERER} !xxx. [NC]

#RewriteCond %{HTTP_REFERER} !^$ [NC]

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

</IfModule>

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

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

<?xml version="1.0" ?>

<configuration>

<system.webServer>

<rewrite>

<rules>

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

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

<conditions>

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

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

</conditions>

<action type="AbortRequest" />

</rule>

</rules>

</rewrite>

</system.webServer>

</configuration>

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

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

推火专家西部数码


Copyright © 2016-2025 www.1681989.com 推火网 版权所有 Power by