I’m writing to ask you for help. I manage a video site, my interest is to make an .mp4 file private, let me explain better.
Inside my web space there are videos that are managed with yendif video player since I use Joomla as CMs. Up to this point the problem does not arise because the user who needs to see the video must be logged in to do so.
The problem arises instead if the customer knows the direct link to the mp4 file for example (www.miosito.com/folder/folder/video.mp4) in this case the user can download it.
I tried two different solutions.
- Modify the group permissions by removing the check with filezilla for reading. By doing so, the registered user cannot see the film.
- Privacy directory present in cpanel, but I excluded this because you need to set a user and password to see the videos.
Turning to you, is there a way to make the video not accessible on the public side and at the same time used for viewing by the logged in user?
Thanks in advance.
2
Answers
The only way to do so is to host the mp4 file in a private folder (not accessible from the web through an .htaccess file), and then only serve that file to authenticated users through a PHP script. Here’s a quick function in python (but can easily be translated to PHP) on how to do it.
you can use htaccess :
Create a hetaccess file in the ROOT_PATH/folder/folder directory next to your videos and put the above code in it.