国家儿童医学中心(上海) | 上海交通大学医学院附属上海儿童医学中心 | 心脏中心 官方知识平台

SS中附件的防盗链设置

陆医生
📅 2010-08-29 · 👁 6 次浏览 · 💬 2 条回复
SS的文件上传巨慢,且不稳定,对于大容积的附件利用SS自身的上传功能肯定是不现实的; 因此考虑还是利用ftp上传到文件夹,然后再给出下载链接,但是这样势必会产生一个盗链的问题; 通过搜索,还是通过定制./datas文件夹中的.htaccess来解决了这个问题,规则如下:
RewriteEngine on

RewriteCond %{HTTP_REFERER} !^http://ibabyheart.com/.*$ 
RewriteCond %{HTTP_REFERER} !^http://ibabyheart.com$ 

RewriteCond %{HTTP_REFERER} !^http://www.ibabyheart.com/.*$ 
RewriteCond %{HTTP_REFERER} !^http://babyheart.com.cn$ 

RewriteCond %{HTTP_REFERER} !^http://www.ibabyheart.com/.*$ 
RewriteCond %{HTTP_REFERER} !^http://www.ibabyheart.com$ 

RewriteCond %{HTTP_REFERER} !^http://www.ibabyheart.com/.*$ 
RewriteCond %{HTTP_REFERER} !^http://bbs.ibabyheart.com$ 

RewriteCond %{HTTP_REFERER} !^http://home.ibabyheart.com/.*$ 
RewriteCond %{HTTP_REFERER} !^http://home.ibabyheart.com$ 

RewriteCond %{HTTP_REFERER} !^http://www.ibabyheart.com/.*$ 
RewriteCond %{HTTP_REFERER} !^http://www.babyheart.com.cn$ 

RewriteCond %{HTTP_REFERER} !^http://bbs.babyheart.com.cn/.*$ 
RewriteCond %{HTTP_REFERER} !^http://bbs.babyheart.com.cn$ 

RewriteCond %{HTTP_REFERER} !^http://home.babyheart.com.cn/.*$ 
RewriteCond %{HTTP_REFERER} !^http://home.babyheart.com.cn$ 

RewriteRule .*.(jpg|jpeg|gif|png|bmp|rar|zip|exe|flv|swf)$ http://ibabyheart.com/no.png [R,NC]
因为.htaccess文件仅涉及当前文件夹权限,因此不会影响其他根目录内文件夹的访问,问题得到完美解决。

全部回复 (2)

陆医生 会员
📅 2010-08-29
SS的文件上传巨慢,且不稳定,对于大容积的附件利用SS自身的上传功能肯定是不现实的; 因此考虑还是利用ftp上传到文件夹,然后再给出下载链接,但是这样势必会产生一个盗链的问题; 通过搜索,还是通过定制./datas文件夹中的.htaccess来解决了这个问题,规则如下:
RewriteEngine on

RewriteCond %{HTTP_REFERER} !^http://ibabyheart.com/.*$ 
RewriteCond %{HTTP_REFERER} !^http://ibabyheart.com$ 

RewriteCond %{HTTP_REFERER} !^http://www.ibabyheart.com/.*$ 
RewriteCond %{HTTP_REFERER} !^http://babyheart.com.cn$ 

RewriteCond %{HTTP_REFERER} !^http://www.ibabyheart.com/.*$ 
RewriteCond %{HTTP_REFERER} !^http://www.ibabyheart.com$ 

RewriteCond %{HTTP_REFERER} !^http://www.ibabyheart.com/.*$ 
RewriteCond %{HTTP_REFERER} !^http://bbs.ibabyheart.com$ 

RewriteCond %{HTTP_REFERER} !^http://home.ibabyheart.com/.*$ 
RewriteCond %{HTTP_REFERER} !^http://home.ibabyheart.com$ 

RewriteCond %{HTTP_REFERER} !^http://www.ibabyheart.com/.*$ 
RewriteCond %{HTTP_REFERER} !^http://www.babyheart.com.cn$ 

RewriteCond %{HTTP_REFERER} !^http://bbs.babyheart.com.cn/.*$ 
RewriteCond %{HTTP_REFERER} !^http://bbs.babyheart.com.cn$ 

RewriteCond %{HTTP_REFERER} !^http://home.babyheart.com.cn/.*$ 
RewriteCond %{HTTP_REFERER} !^http://home.babyheart.com.cn$ 

RewriteRule .*.(jpg|jpeg|gif|png|bmp|rar|zip|exe|flv|swf)$ http://ibabyheart.com/no.png [R,NC]
因为.htaccess文件仅涉及当前文件夹权限,因此不会影响其他根目录内文件夹的访问,问题得到完美解决。
陆医生 会员
📅 2010-08-29
发现利用data.ibabyheart.com引用flv视频的时候有问题,把data.ibabyheart.com加入允许队列也没用,暂时把flv和swf的防盗链取消吧。
陆医生 会员
📅 2010-09-02

✏️ 写回复

登录后即可回复

👤 用户信息

加载中…