开发者

How to prevent hotlinking of flv files?

How to, using PHP and/or .htaccess prevent hotlinking?

There's a site, which is allowed to access the flv files located on my server, however I've noticed that there are many requests from other domains as well...

Here's the actual rule:

RewriteCond %{HTTP_REFERER} !^http://alloweddomain.com/.*$ [NC]
RewriteRule .flv den开发者_运维百科ied.php [NC,L]

It's working OK except for Firefox, because FF is not sending referrer info when accessing .flv files...


Add a condition for blank referrers:

RewriteCond %{HTTP_REFERER} ^$ [OR]
RewriteCond %{HTTP_REFERER} !^http://alloweddomain.com/.*$ [NC]
RewriteRule .flv denied.php [NC,L]

http://www.htaccesstools.com/hotlink-protection/ is a good place to start.


Also allow requests with no referrer at all. Some firewalls also block referrers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜