Chinaunix首页 | 论坛 | 博客
  • 博客访问: 90339
  • 博文数量: 33
  • 博客积分: 1088
  • 博客等级: 少尉
  • 技术积分: 365
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-30 13:59
文章分类

全部博文(33)

文章存档

2011年(18)

2010年(9)

2009年(6)

分类: 系统运维

2009-12-05 21:49:34

直接进入正题,apache的防盗链:
 

RewriteEngine On

RewriteCond %{HTTP_REFERER} !^$

#RewriteCond %{REQUEST_URI} !^/t/.*$ [NC]

RewriteCond %{HTTP_REFERER} !^http.*://gonline\.com/.*$ [NC]

RewriteCond %{HTTP_REFERER} !^http.*://(.)+\. gonline\.com/.*$ [NC]

#RewriteCond %{HTTP_REFERER} !google\.com [NC]

RewriteRule .*\.(jpg|gif|png|bmp)$ http://file1.gonline.com/images/include/logo.png [L,NC]

配置说明:

         :验证mod_rewrite模块是否打开

         RewriteEngine On:打开rewrite功能

         RewriteCond %{HTTP_REFERER} !^$:判断请求来源HTTP_REFERER

         RewriteCond %{REQUEST_URI} !^/t/.*$ [NC]:判断请求内容位置REQUEST_URI是否为/t//t/下的文件允许访问

         RewriteCond %{HTTP_REFERER} !^http.*://gonline\.com/.*$ [NC]

RewriteCond %{HTTP_REFERER} !^http.*://(.)+\. gonline\.com/.*$ [NC]:允许域名及其子域名访问,同时包括httphttps

RewriteRule .*\.(jpg|gif|png|bmp)$ http://file1.gonline.com/images/include/logo.png [L,NC]:将反盗链的图片转到http://file1.gonline.com/images/include/logo.png

R表示转接、L表示终止匹配,结束返回、NC不区分大小写

阅读(484) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~