apache 防盗链两例

| |
[不指定 2007/05/28 15:38 | by Else ]
apache 防盗链两例

1.利用rewrite 确认你的apache 能使用rewrite mod
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://cuku.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.cuku.net$ [NC]
RewriteCond %{HTTP_REFERER} !^http://aixq.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.aixq.com$ [NC]
RewriteRule .*.(gif|jpb|png|css|js|swf])$ http://www.aixq.com/img/logo.gif[R,NC[R,NC]

其中有色的地方都是要改为你的:
 红色:就是改为你提供下载页面的地址,也就是只有通过这个地址才可以下载你所提供的东东。
 蓝色:就是要保护文件的扩展名(以|分开),也就是说以这些为扩展名的文件只有通过红色的地址才可以访问。
 绿色:如果不是通过红色的地址访问蓝色这些为扩展名的文件时就回重定向到绿色地址上。


2.利用SetEnvIfNoCase 和 access

SetEnvIfNoCase Referer "^http://cuku.net" local_ref=1
SetEnvIfNoCase Referer "^http://www.cuku.net" local_ref=1
<FilesMatch ".(gif|jpb|png|css|js|swf)">
Order Allow,Deny
Allow from env=local_ref
</FilesMatch>

红色为信任站点,蓝色为受保护的文件扩展名。

出处:http://www.phpwind.net/read-htm-tid-153039-fpage-1.html


作者:Else 's Blog
地址:http://www.aixq.com/post/711/
版权所有。转载时必须链接形式注明作者和原始出处及本声明!
  • 中查看更多“apache 防盗链两例”相关内容
  • 中查看更多“apache 防盗链两例”相关内容
  • 中查看更多“apache 防盗链两例”相关内容
  • 中查看更多“apache 防盗链两例”相关内容
  • 中查看更多“apache 防盗链两例”相关内容
  • 中查看更多“apache 防盗链两例”相关内容

  • 最后编辑: Else 编辑于2007/05/28 15:40
    代码 程序 编程 | 评论(0) | 引用(0) | 阅读(1509)
    发表评论
    表情
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    emotemotemotemotemot
    打开HTML
    打开UBB
    打开表情
    隐藏
    昵称   密码   游客无需密码
    网址   电邮   [注册]
                   

    验证码 不区分大小写