APACHE prohibits Image leeching

Source: Internet
Author: User

1. Assume that the link is sufficient.ImageThe host domain name of is:Www.phpcy.cn

2. Modify httpd. conf.

SetEnvIfNoCase Referer "^ http://www.phpcy.cn/" local_ref = 1
<FilesMatch ". (gif | jpg)">
Order Allow, Deny
Allow from env = local_ref
</FilesMatch>


This simple application can not only solveImage leechingA slight modification can also prevent any file leeching and downloading problems.

UseMethodWhen you link images from unspecified hosts, the images cannot be displayed. If you want to display a "leeching prohibited" image, you can use mod_rewrite.

FirstInstall ApacheThe -- enable-rewrite parameter must be added to load the mod_rewrite module.

Assume that the image of the anti-Leech feature is abc.gif. We can configure it in httpd. conf as follows:


RewriteEngine on
RewriteCond % {HTTP_REFERER }! ^ $
RewriteCond % {HTTP_REFERER }! ^ Http: // (www \.)? Test.com/. * $ [NC]
RewriteRule \. (gif | jpg) $Http://www.phpcy.cn/abc.gif[R, L]
 


When the host image is leeched, only the "leeching prohibited" image of abc.gif is displayed!

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.