I would like to protect audio files in a public Apache directory.
I do not necessarily want to download the file (I saw several tips about it) but rather play it in the browser only for users who have an active session.
I have already changed the .htaccess
to not list the files in the directory, but they are still accessed directly by the URL without having to be logged in.
<audio controls>
<source src="/audios/audio.wav" type="audio/wav">
</audio>
The only game that I imagined was to put the files in the /home/user/audios
directory, for example, and when the user wants to listen, copy the audio to the public folder and play it. You would also need a routine to delete the files periodically.
I wish I could have a second opinion.
Thank you in advance.
PS. I'm using PHP.