Iis image anti-Leech and File Download resource anti-leech

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.