Reputation: 19
I am referring to the following code on this page:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?localhost.*$ [NC]
RewriteRule \.(gif|jpg)$ - [F]
(htaccess) How to prevent a file from DIRECT URL ACCESS?
I use this way:
RewriteCond %{HTTP_REFERER} !^mysite.net\.ltd [NC]
RewriteCond %{HTTP_REFERER} !^mysite.net\.ltd.*$ [NC]
RewriteRule \.(mp3|m4a|ogg|wav)$ - [F]
But this does not play the audio file on the site. Please help me. Thanks
Upvotes: 0
Views: 191
Reputation:
You can do what YouTube does to make it difficult for non technical users to download your media file. YouTube uses the HTML5 video element (There is also a HTML5 audio element.) which supports Dynamic Adaptive Streaming over HTTP (DASH). Using DASH the media file is never available directly but instead the contents of the media is streamed (in chunks). The video element reconstructs the media from the chunks in the stream. (Although a skilled developer can reconstruct the media file from the chunks, this is not easy to do.) Please note that this requires the server to send a DASH stream. AFAIK WordPress does not have builtin support for DASH but DASH is available using plugins.
Upvotes: 1