0

how can I prevent the user to access my /v folder in my website where I have some video, but allow them to be display on frontend thanks to the <\video> tag from HTML 5 ?

I tried this and other stuff in my /v folder :

RewriteEngine on 
RewriteCond %{HTTP_REFERER} !^http://sub.domain.com [NC]  
RewriteRule \.(mp4)$ - [F]

but the fill is not forbidden (cache already cleared)

0

it depends on your Apache version and env configuration:

RewriteCond "%{HTTP_REFERER}" "!^$"
RewriteCond "%{HTTP_REFERER}" "!sub.domain.com" [NC]
RewriteRule "\.mp4$"    "-"   [F,NC]

but correct way also to load your files from within application itself, add random hashed request in php to load / get files. and hide location /v.

so request is not: /path/to/v/video.mp4

but will be hashed request: /path/to/hash_8475nd784tn84gndofjewbc83/video.mp4

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.