Only allow WordPress the access to Video files

Im using WordPress along with Video.js.
Working nicely so far, but I would like to prevent the Users from downloading the Videos.

Is there a way for my Server to only allow access to the Files if the request was made from WordPress?
I dont insist on using Video.js, if there is some other Plugin, that might do the Magic.

Related posts

Leave a Reply

2 comments

  1. The first thing that comes to mind is within cPanel most hosts have hotlink protection. You can allow only certain URL’s to use your files.

    enter image description here

    Or disabling copy/paste with JavaScript MIGHT stop novice web peeps:

    function onKeyDown() {
      // current pressed key
      var pressedKey = String.fromCharCode(event.keyCode).toLowerCase();
      if (event.ctrlKey && (pressedKey == "c" || 
                            pressedKey == "v")) {
        // disable key press porcessing
        event.returnValue = false;
      }
    } // onKeyDown
    
  2. Since you don’t have cPanel access you can prevent it from within the htaccess file.
    This is untested but looks great.

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www.)example.com/.*$ [NC]
    RewriteRule .(gif|jpg|jpeg|bmp|zip|rar|mp3|flv|swf|xml|php|png|css|pdf)$ - [F]
    Serve alternate content
    

    To serve alternate content when hotlinking is detected. You can set up your .htaccess file to actually display different content when hotlinking is attempted. This is more commonly done with images suggesting your displeasure of this activity, such as serving up an “Angry Man” image in place of the hotlinked one. Once again, replace example.com on lines 3 and 4 with your own domain name.

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www.)example.com/.*$ [NC]
    RewriteRule .(gif|jpg)$ http://www.example.com/angryman.gif [R,L]