+ -
当前位置:首页 → 问答吧 → apache防盗链规则

apache防盗链规则

时间:2007-08-24

来源:互联网

1.Preventing hot linking of images and other file types
复制PHP内容到剪贴板
PHP代码:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule .(gif|jpg|js|css)$ - [F]

2.Serving alternate content when hot linking is detected
复制PHP内容到剪贴板
PHP代码:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule .(gif|jpg)$ [img]http://www.mydomain.com/angryman.gif[/img] [R,L]

[ 本帖最后由 netseek 于 2007-8-24 09:33 编辑 ]

作者: netseek   发布时间: 2007-08-23

好贴子一定要顶!

作者: hongfeng   发布时间: 2007-08-24

当然要顶

作者: 深海的带鱼   发布时间: 2007-08-27

作者: jefsun   发布时间: 2008-03-19