当前位置: 首页 > 图文教程 > 网络编程 > PHP > PHP技巧代码:apache 防盗链两例

PHP
include()与require()的对比
php和asp对象的等价关系
PHP, JScript 和 VBScript 函数和类的语法
PHP:MVC迷思
PHP脚本的8个技巧(1)
PHP脚本的8个技巧(2)
PHP脚本的8个技巧(3)
PHP脚本的8个技巧(4)
PHP脚本的8个技巧(5)
PHP脚本的8个技巧(6)
PHP脚本的8个技巧(7)
PHP脚本的8个技巧(8)
PHP教程.经验技巧(上)
递归列出所有文件和目录
PHP的历史和优缺点
PHP下MAIL的另一解决方案
PHP文本数据库的搜索方法
PHP调用三种数据库的方法(1)
PHP调用三种数据库的方法(2)
PHP调用三种数据库的方法(3)

PHP技巧代码:apache 防盗链两例


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 87 ::
收藏到网摘: n/a

核心提示:1.利用rewrite 确认你的apache 能使用rewrite mod RewriteEngine on RewriteCond %{HTTP_REFERER} !^http://ruanchen.com/"#ff6600">1.利用rewrite 确认你的apache 能使用rewrite mod

RewriteEngine on
  RewriteCond %{HTTP_REFERER} !^http://ruanchen.com/"#ff6600">2.利用SetEnvIfNoCase 和 access

SetEnvIfNoCase Referer "^http://ruanchen.com" local_ref=1
    SetEnvIfNoCase Referer "^http://www.ruanchen.com" local_ref=1
    <FilesMatch "\.(gif|jpb|png|css|js|swf)">
        Order Allow,Deny
        Allow from env=local_ref
    </FilesMatch>

红色为信任站点,蓝色为受保护的文件扩展名。