Generally, our website has two types of anti-leech protection: Anti-image leeching and anti-file leeching. Next we will introduce in detail their practices in iis.
The Code is as follows: |
Copy code |
RewriteCond Host: (. +) RewriteCond Referer :(?! Http: // 1 .*).* RewriteRule .*.(? : Gif | jpg | jpeg | png | bmp)/block.gif [I, O, N] |
Deprecated anti-Leech, so we can use baidu, google, and other search engines to display our images.
The Code is as follows: |
Copy code |
RewriteCond Host: (. +) RewriteCond Referer :(?! Http: // 1 .*).* RewriteCond Referer :(?! Http: // (. *) (.baidu.com | .google.com | .google.cn | .g.cn | region | .soso.com | region | .youdao.com | .bing.com | .yahoo.com | .yahoo.cn | region )).* RewriteRule .*.(? : Gif | jpg | jpeg | png | bmp)/block.gif [I, O, N] |
Another method
The Code is as follows: |
Copy code |
RewriteCond Host: ^ (. +) $ RewriteCond Referer: ^ (?! Http: // \ 1. *). * $ RewriteCond Referer: ^ (?! Http: //. * .baidu.com |. * .google.com |. * googlebot.com |. * .abc.net). *). * $ RewriteRule ^ (?! (/Logo.gif |/2_files/logo_tg.gif )).*.(? : Gif | jpg | jpeg | png) $/block.gif [I, O, N]
|
A. www.abc.net in the third row of the above rule is your website domain name. Please make corresponding changes according to the actual situation. The baidu.com and google.com in it are designed not to prevent search engine spider from capturing images.
B. In the fourth line,/logo.gif and 2_fies/logo_tg.gif serve as the address of your logo image. The purpose is to allow other people to use your logo through links. If you do not need it, remove "(?! (/Logo.gif |/2_files/logo_tg.gif ))". You can modify the subsequent gif files as needed.
Remember to restart IIS. At this time, anti-leeching starts to take effect. Requests from other websites from leeching will be rejected. Otherwise, they will not be able.
TIPS: some of the above accesses can download resources from your website through software, which requires some server widgets, which can be found online or free of charge.