apache、iis規(guī)則設置防盜鏈
- 威海網(wǎng)站建設 威海防盜鏈
- 1618
Linux下規(guī)則文件.htaccess(手工創(chuàng)建.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是被盜鏈后的提示內(nèi)容文件
Windows2008、2012或更高系統(tǒng)下規(guī)則文件web.config (手工創(chuàng)建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規(guī)則屏蔽攔截蜘蛛抓取
來源:西部數(shù)碼