apache rewrite防盗链三例 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] Re
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 webmaster@etoow.com
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>
本文标题为:apache rewrite防盗链三例


基础教程推荐
- 为Win2003服务器打造铜墙铁壁的方法步骤 2022-09-01
- RFO SIG之openEuler AWS AMI 制作详解 2022-12-28
- Docker容器操作方法详解 2022-11-13
- Centos7 nginx的安装以及开机自启动的设置 2023-09-22
- Centos 安装Django2.1 2023-09-24
- Apache Kafka 2.5 稳定版发布,新特性抢先看 2023-09-11
- Apache CarbonData 1.0.0发布及其新特性介绍 2023-09-11
- windows环境下apache-apollo服务器搭建 2023-09-10
- P3 利用Vulnhub复现漏洞 - Apache SSI 远程命令执行漏洞 2023-09-10
- 通过StatefulSet部署有状态服务应用实现方式 2022-10-01