Anti-leech protection for iis and apache

Source: Internet
Author: User

Currently, there is a product that supports iis urlrewrite. Its name is isapi_rewrite.

For my website, the anti-leech protection method is to add the following statement to httpd. ini:

Rewritecond host: (. +)

Rewritecond referer :(?! Http: // 1 .*).*

Rewriterule .*.(? : Gif | jpg | png | exe | rar | zip)/block.gif [I,

 

O]


Modify the httpd. ini file in the installation directory (if the file is "read-only", remove "read-only" and modify it again)
Add:

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]


Apache

To enable the image anti-leech function, add the following code to the htaccess file:

Rewriteengine on
Rewritecond % {http_referer }! ^ $
Rewritecond % {http_referer }! ^ Http: // (www .)? Allow1.com (/)?. * $ [Nc]
Rewritecond % {http_referer }! ^ Http: // (www .)? Allow2.com (/)?. * $ [Nc]
Rewriterule. *. (gif | jpg | jpeg | bmp | png) $ [r, nc, l]

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.