htaccess的防盗链 [英] htaccess hotlink protection

查看:140
本文介绍了htaccess的防盗链的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我想用htaccess的保护FLV文件。

So I'm trying to protect FLV files using htaccess.

基本上,我想阻止直接访问。FLV(让空白引荐),并从任何网站,是不是我自己的块盗链。

Basically I want to block direct access to the .flv (so blank referrer) and block hotlinking from any website that isn't my own.

我这样做从Word preSS安装,但它不是根,它是在一个子目录。所以mydomain.com/test/videos /

I'm doing this from a WordPress install but it's not on the root, it's in a subdirectory. so mydomain.com/test/videos/

我已经试过以下code,但我仍然可以键入FLV和镀铬的直接将文件名,下载文件,因此它不工作:

I've tried the following code but I am still able to type a direct filename of the flv and chrome will download the file, so it isn't working:

RewriteEngine on
RewriteBase /test/videos/
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.co.uk(/)?.*$ [NC]
RewriteRule \.(flv)$ templates/images/logo.jpg [L,NC]

任何这是怎么回事错误的想法?它不返回一个服务器错误。

Any ideas where this is going wrong? it doesn't return a server error.

推荐答案

试试这个:

    RewriteEngine on    
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?mydomain.co.uk/test/videos [NC]
    RewriteRule \.(flv)$ - [NC,F,L]

这篇关于htaccess的防盗链的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆