apache rewrite防盜鏈三例
更新時間:2007年07月10日 00:00:00 作者:
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>
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>
相關文章
在域環(huán)境中配置ISA Server 2004的圖文教程
在域環(huán)境中配置ISA Server 2004的圖文教程...2006-12-12
HTML靜態(tài)頁面引入公共html文件(ssi服務器端指令詳解)
今天為大家介紹一種在HTML靜態(tài)文件中引用其它HTML靜態(tài)文件的方法SSI的詳細使用方法與指令介紹2018-04-04

