Configuration Example of Apache anti-image leeching

Source: Internet
Author: User

The most intolerable part of our hard-to-do websites is the collection, leeching, and leeching of website resources, which will seriously slow down the speed of our website and, if it is space, the monthly traffic is limited, which consumes a large amount of traffic, which is a serious problem.

The following rules can be used to configure anti-Leech protection for counterattack.

RewriteCond % {HTTP_REFERER }! ^ Http: // (www .)? Your_domain.com (/)? (.*)? $ [NC]
RewriteCond % {HTTP_REFERER }! ^ Http://m.your _ domain.com (/)? (.*)? $ [NC]
RewriteRule. * \. (jpg | png) $ http://www.111cn.net/images/fangdaolian.png [R, NC]

(Www .)? Indicates that no www., followed (/)? Similarly, it means that without/, you can think of www. your_domain.com, www. your_domain.com/, your_domain.com, www. your_domain.com/, and the last (.*)? Wildcard all links under the entire domain name.

RewriteRule. * \. (jpg | png) $ indicates that it is not the website specified in RewriteCond. When accessing all jpg or png files, it will jump
Http://www.111cn.net/images/fangdaolian.png address, thus the success of anti-Leech.

However, it should be noted that the images with the anti-Leech prompt cannot use the images in the RewriteCond domain name, otherwise they will be in an endless loop.

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.