English
 电子信箱
 加入收藏

  威盾防火墙 >> 新闻中心 >> 威盾新闻 >> apache rewrite防盗链三例

 

apache rewrite防盗链三例

威盾防火墙 2015-01-22

 
1.利用rewrite 确认你的apache 能使用rewrite mod 
RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^http://linuxsky.net/.*$ [NC] 
RewriteCond %{HTTP_REFERER} !^http://linuxsky.net$ [NC] 
RewriteCond %{HTTP_REFERER} !^http://www.linuxsky.net/.*$ [NC] 
RewriteCond %{HTTP_REFERER} !^http://www.linuxsky.net$ [NC] 
RewriteRule .*\.(gif|jpb|png|css|js|swf])$ http://www.linuxsky.net [R,NC] 
其中有色的地方都是要改为你的: 
  
红色:就是改为你提供下载页面的地址,也就是只有通过这个地址才可以下载你所提供的东东。 
  
蓝色:就是要保护文件的扩展名(以|分开),也就是说以这些为扩展名的文件只有通过红色的地址才可以访问。 
  
绿色:如果不是通过红色的地址访问蓝色这些为扩展名的文件时就回重定向到绿色地址上。 
2.利用SetEnvIfNoCase 和 access 
SetEnvIfNoCase Referer "^http://linuxsky.net" local_ref=1 
SetEnvIfNoCase Referer "^http://www.linuxsky.net" local_ref=1 

Order Allow,Deny 
Allow from env=local_ref 
红色为信任站点,蓝色为受保护的文件扩展名。  


3.<VirtualHost *:80> 
ServerAdmin [email protected] 
DocumentRoot D:/www/www.etoow.com 
ServerName www.etoow.com 
ServerAlias etoow.com 
ServerAlias www.chinahtml.net 
ServerAlias chinahtml.net 
ServerAlias www.chinahtml.cn 
ServerAlias chinahtml.cn 
ErrorDocument 404 http://www.etoow.com/error.html 
SetEnvIfNoCase Referer "^http://www.etoow.com" local_ref=1 
SetEnvIfNoCase Referer "^http://etoow.com" local_ref=1 
<FilesMatch "\.(gif|jpb|png|css|js|swf)"> 
Order Allow,Deny 
Allow from env=local_ref 
</FilesMatch> 
</VirtualHost>

相关内容: 最新内容:
IIS防盗链 ISAPI Rewrite图片防盗链规则写法[2015-01-22]
Apache下MP3 防盗链的解决办法[2015-01-22]
Apache 防盗链的技术小结[2015-01-22]
web防盗链的作用[2015-01-22]
图片、文件防盗链程序[2015-01-19]
WordPress博客图片防盗链方法总结[2015-01-19]
ThinkPHP中自定义错误页面和提示页面实例[2015-01-22]
ThinkPHP控制器间实现相互调用的方法[2015-01-22]
基于php伪静态的实现详细介绍[2015-01-22]
php 伪静态之IIS篇[2015-01-22]
ISAPI Rewrite多站点破解版 完美实现IIS伪静态的方法[2015-01-22]
apache伪静态与iis伪静态规则与配置区别介绍[2015-01-22]