Topic: 对于防止图片盗链的办法

  Print this page

1.对于防止图片盗链的办法 Copy to clipboard
Posted by: alexyu2000
Posted on: 2003-12-05 12:06

对于图片引用,这个是检查了referer字段,防止图片被盗连。
参见:
http://httpd.apache.org/docs/misc/FAQ-G.html#image-theft

How can I prevent people from "stealing" the images from my web site?
The goal here is to prevent people from inlining your images directly from their web site, but accessing them only if they appear inline in your pages.

This can be accomplished with a combination of SetEnvIf and the Deny and Allow directives. However, it is important to understand that any access restriction based on the REFERER header is intrinsically problematic due to the fact that browsers can send an incorrect REFERER, either because they want to circumvent your restriction or simply because they don't send the right thing (or anything at all).

The following configuration will produce the desired effect if the browser passes correct REFERER headers.

SetEnvIf REFERER "www\.mydomain\.com" linked_from_here
SetEnvIf REFERER "^$" linked_from_here

<Directory /www/images>
Order deny,allow
Deny from all
Allow from env=linked_from_here
</Directory>

Further examples can be found in the Environment Variables documentation.

2.Re:对于防止图片盗链的办法 [Re: alexyu2000] Copy to clipboard
Posted by: hao0323
Posted on: 2004-02-14 11:24

英文的


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923