Apache防盗链设置
说明:本文来自网络
位置一般情况下在 /usr/local/apache/conf/httpd.conf
或者apache 2.2 的 /usr/local/apache2/conf/extra/httpd-vhost.conf
添加
SetEnvIfNoCase Referer "^http://www.ccvita.com" local_ref=1
SetEnvIfNoCase Referer "^http://ccvita.com" local_ref=1
<filesmatch "\.(txt|doc|mp3|zip|rar|jpg|gif)">
Order Allow,Deny
Allow from env=local_ref
</filesmatch>
还一种写法,是用正则的,这种写法在各个版本的apache比较通用。
写法是
SetEnvIfNoCase Referer "^<strong>http://.*\.yourdomin\.com</strong>" local_ref=1
SetEnvIfNoCase Referer "<strong>.*\.yourdomin\.com</strong>" local_ref=1
<filesmatch "\.(txt|doc|mp3|zip|rar|jpg|gif)">
Order Allow,Deny
Allow from env=local_ref
</filesmatch>
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/qianling3439/archive/2009/02/05/3864248.aspx
位置一般情况下在 /usr/local/apache/conf/httpd.conf
或者apache 2.2 的 /usr/local/apache2/conf/extra/httpd-vhost.conf
添加
SetEnvIfNoCase Referer "^http://www.ccvita.com" local_ref=1
SetEnvIfNoCase Referer "^http://ccvita.com" local_ref=1
<filesmatch "\.(txt|doc|mp3|zip|rar|jpg|gif)">
Order Allow,Deny
Allow from env=local_ref
</filesmatch>
还一种写法,是用正则的,这种写法在各个版本的apache比较通用。
写法是
SetEnvIfNoCase Referer "^<strong>http://.*\.yourdomin\.com</strong>" local_ref=1
SetEnvIfNoCase Referer "<strong>.*\.yourdomin\.com</strong>" local_ref=1
<filesmatch "\.(txt|doc|mp3|zip|rar|jpg|gif)">
Order Allow,Deny
Allow from env=local_ref
</filesmatch>
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/qianling3439/archive/2009/02/05/3864248.aspx
none