1
votes

I have video files in a folder. And I want to restrict the users from directly accessing them. I have my .htaccess like this

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.

Actual response:

Its working fine for Chrome. But in all other browsers (firefox, opera, midori) Its giving StreamNotFound error. What is the issue? Any help please.

1

1 Answers

0
votes

Try this rule:

RewriteEngine on

RewriteCond %{HTTP_REFERER} !^$ [NC] 
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost [NC] 
RewriteRule \.(mp4|flv)$ - [NC,F]