咨询热线:4006-75-4006

售前:9:00-23:30    备案:9:00-18:00    技术:7*24h

Apache 如何防盗链

2016-10-11 19:12:41 6328次

首先确定已经加载apache rewrite模块
LoadModule rewrite_module modules/mod_rewrite.so

1) 利用rewrite 确认你的apache 能使用rewrite mod

  RewriteEngine on
   RewriteCond %{HTTP_REFERER} !^http://www.landui.com/.*$      [NC]
   RewriteCond %{HTTP_REFERER} !^http://www.landui.com$      [NC]
   RewriteCond %{HTTP_REFERER} !^http://www.landui.com/.*$      [NC]
   RewriteCond %{HTTP_REFERER} !^http://www.landui.com$      [NC]
   RewriteRule .*.(gif|jpb|png|css|js|swf])$ http://www.landui.com/about/nolink.png [R,NC] #指定图片.
   


2) 利用SetEnvIfNoCase 和 access

    SetEnvIfNoCase Referer "^http://www.landui.com" local_ref=1
    SetEnvIfNoCase Referer "^http://www.landui.com" local_ref=1
    Order Allow,Deny
    Allow from env=local_ref
     




首页
最新活动
个人中心