apache rewrite防盜鏈三例
更新時間:2007年07月10日 00:00:00 作者:
1.利用rewrite 確認(rèn)你的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>
相關(guān)文章
利用.Htaccess阻止IP惡意攻擊網(wǎng)站,禁止指定域名訪問,禁止機器爬蟲,禁止盜鏈
本文主要介紹了如何利用.Htaccess解決IP惡意攻擊,指定域名阻擋訪問,使用.Htaccess禁止機器爬蟲,使用.Htaccess禁止盜鏈的方法2018-12-12linux下安裝apache與php;Apache+PHP+MySQL配置攻略
linux下安裝apache與php;Apache+PHP+MySQL配置攻略...2007-05-05虛擬主機封殺webshell提權(quán)!!!!!!!!!!
虛擬主機封殺webshell提權(quán)!!!!!!!!!!...2006-12-12備份和恢復(fù)Windows IIS服務(wù)器設(shè)置的方法
備份和恢復(fù)Windows IIS服務(wù)器設(shè)置的方法...2007-04-04