[英]Restricting direct access to files using .htaccess
I have video files in a folder. 我的文件夹中有视频文件。 And I want to restrict the users from directly accessing them. 我想限制用户直接访问他们。 I have my .htaccess like this 我有这样的我的.htaccess
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost.*$ [NC]
RewriteRule \.(mp4|flv)$ - [F]
IDEA: 理念:
This will allow the browser to access my video when requested from page. 当页面发出请求时,这将允许浏览器访问我的视频。 But it will deny direct access from url. 但是它将拒绝从url直接访问。
Actual response: 实际回应:
Its working fine for Chrome. 它对Chrome的运行正常。 But in all other browsers (firefox, opera, midori) Its giving StreamNotFound error. 但是在所有其他浏览器(firefox,opera,midori)中,其出现StreamNotFound错误。 What is the issue? 有什么问题 Any help please. 请帮忙。
Try this rule: 尝试以下规则:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost [NC]
RewriteRule \.(mp4|flv)$ - [NC,F]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.