如何防止flv文件被盗链?
如何使用 PHP 和/或 .htaccess 防止热链接?
有一个网站,允许访问位于我的服务器上的 flv 文件,但是我注意到也有许多来自其他域的请求...
这是实际规则:
RewriteCond %{HTTP_REFERER} !^http://alloweddomain.com/.*$ [NC]
RewriteRule .flv denied.php [NC,L]
除了 Firefox 之外,它工作正常,因为 FF 是访问 .flv 文件时不发送引荐来源网址信息...
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 denied.php [NC,L]
It's working OK except for Firefox, because FF is not sending referrer info when accessing .flv files...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
添加空白引荐来源网址的条件:
http://www.htaccesstools.com/hotlink-protection/ 是一个很好的起点。
Add a condition for blank referrers:
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.