Apache 防盗链办法

728x15 ad here

出自Guoshuang Wiki

跳转到: 导航, 搜索

我用的是 .htaccess 文件办法

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://gallery.ubuntu4life.com/.*$ [NC]
RewriteRule .*\.jpg$ http://gallery.ubuntu4life.com/nolink.gif

xiaohui 的代码在我这里不起作用

# 防盗链配置 
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://xiaohui.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://xiaohui.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.xiaohui.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.xiaohui.com$ [NC]
RewriteRule .*\.(gif|jpg|swf)$ http://www.xiaohui.com/about/nolink.png [R,NC]

可能是前面的 on 大小写?还是最后一句的 R,NC?

个人工具
125x125 ad here
Advertisement
120x600 ad here