apache、iis、nginx拦截屏蔽referer域名
admin
2021-08-04 PM
756℃
0条
apache
<IfModule mod_rewrite.c>
RewriteEngine On
#Block domain
RewriteCond %{HTTP_REFERER} www.abc.com [NC]
RewriteRule ^(.*)$ -[F]
</IfModule>
iis
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="屏蔽访问">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_REFERER}" pattern="www.abc.com" ignoreCase="true" />
</conditions>
<action type="AbortRequest" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
nginx
if ($http_referer !~* "www.abc.com|^$") {
return 444;
}