站长论坛
标题:
在apache的httpd.conf设置文件防盗链
[打印本页]
作者:
tzlink
时间:
2007-9-10 22:00
标题:
在apache的httpd.conf设置文件防盗链
参考文档:
Preventing Image 'Theft'
SetEnvIfNoCase 和 SetEnvIf 的说明文档
http://apache.chinahtml.com/mod/mod_setenvif.html#setenvif
httpd.conf 的修改处
SetEnvIfNoCase Referer "^http://(.)+\.chinahtml\.com/" local_ref=1
SetEnvIfNoCase Referer "^http://(.)+\.laogui\.com/" local_ref=1
SetEnvIfNoCase Referer "^http://(.)+\.geekg\.com/" local_ref=1
SetEnvIfNoCase Referer "^http://(.)+\.necktie\.gov\.cn/" local_ref=1
SetEnvIfNoCase Referer "^http://(.)+\.necktie\.net\.cn/" local_ref=1
SetEnvIfNoCase Referer "-" local_ref=1
######## Allow the LOGO image Theft ##########
SetEnvIf Request_URI "/images/logo(.)+" local_ref=0
Order Allow,Deny
Allow from env=local_ref
<
复制代码
如果大家在看本网站的图片上有问题的话,请给我来信~~
同时,比如像论坛一样的网站,很多图片都是论坛的按钮之类的,如果你不想记录图片信息,可以这样定制 log 文件:
<FilesMatch "\.(png|gif|jpg)">
SetEnv IMAGES 1
</FilesMatch>
ErrorLog logs/bbs.hzmjp.com-error_log
CustomLog logs/bbs.hzmjp.com-access_log combined env=!IMAGES
当然还可以用 SetEnvIf Request_URI 之类的语法定制,之后log里面就不会记录诸如 /templates/subSilver/images/spacer.gif 这样的附带图片记录了。
欢迎光临 站长论坛 (http://www.tzlink.com/bbs/)
Powered by Discuz! X3.2