apache rewrite防盜鏈三例
更新時(shí)間: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]
其中有色的地方都是要改為你的:
紅色:就是改為你提供下載頁面的地址,也就是只有通過這個地址才可以下載你所提供的東東。
藍(lán)色:就是要保護(hù)文件的擴(kuò)展名(以|分開),也就是說以這些為擴(kuò)展名的文件只有通過紅色的地址才可以訪問。
綠色:如果不是通過紅色的地址訪問藍(lán)色這些為擴(kuò)展名的文件時(shí)就回重定向到綠色地址上。
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
紅色為信任站點(diǎn),藍(lán)色為受保護(hù)的文件擴(kuò)展名。
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]
其中有色的地方都是要改為你的:
紅色:就是改為你提供下載頁面的地址,也就是只有通過這個地址才可以下載你所提供的東東。
藍(lán)色:就是要保護(hù)文件的擴(kuò)展名(以|分開),也就是說以這些為擴(kuò)展名的文件只有通過紅色的地址才可以訪問。
綠色:如果不是通過紅色的地址訪問藍(lán)色這些為擴(kuò)展名的文件時(shí)就回重定向到綠色地址上。
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
紅色為信任站點(diǎn),藍(lán)色為受保護(hù)的文件擴(kuò)展名。
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)站,禁止指定域名訪問,禁止機(jī)器爬蟲,禁止盜鏈
本文主要介紹了如何利用.Htaccess解決IP惡意攻擊,指定域名阻擋訪問,使用.Htaccess禁止機(jī)器爬蟲,使用.Htaccess禁止盜鏈的方法2018-12-12三種Web開發(fā)主流技術(shù)的性價(jià)評價(jià)
三種主流技術(shù)是哪三種呢?我主要講一下ASP(ActiveX Server Page)、PHP、Java這三種技術(shù)。主要是基于我到現(xiàn)在已經(jīng)使用的以下產(chǎn)品而談:2008-03-03linux下安裝apache與php;Apache+PHP+MySQL配置攻略
linux下安裝apache與php;Apache+PHP+MySQL配置攻略...2007-05-05虛擬主機(jī)封殺webshell提權(quán)!!!!!!!!!!
虛擬主機(jī)封殺webshell提權(quán)!!!!!!!!!!...2006-12-12備份和恢復(fù)Windows IIS服務(wù)器設(shè)置的方法
備份和恢復(fù)Windows IIS服務(wù)器設(shè)置的方法...2007-04-04