title: How To Prevent File HotLink from Internet Download Manager IDM
body: <p>Am having some issue fixing media file hotlink or download using IDM, am working on serving a video file using PHP and it works fine, but I notice that IDM installed on my computer was able to add download box to the video I am playing using jwplayer.
  I change the structure of code and added htaccess to rewrite the link, so that the direct access to the file is not display.</p>
  
  <p><code>mysite.com/file.php?myvideo.flv -&gt; mysite.com/api/file/JU78vhx5uh</code></p>
  
  <p>I was able to implement this in JWPlayer and it works when serving with PHP, yet the same IDM fetch my video file, I search for other means which is htaccess and it is below</p>
  
  <pre><code>RewriteEngine on
  
  RewriteCond %{HTTP_REFERER} !^http://(.+\.)?mysite\.com/ [NC]
  
  RewriteCond %{HTTP_REFERER} !^$
  
  RewriteRule .*\.(mp4|flv|mp4|mp3)$ /video/thieve.flv [L]
  </code></pre>
  
  <p>This only work for web browsers and doesn't stop IDM software, I found another PHP referer validator, which check the refere link.</p>
  
  <pre><code>if (strpos($_SERVER['HTTP_REFERER'],'mysite.com')===0)
  
   {
      header("Location: whatever.php"};
   }else{
      header("Location: index.php");
   }
  </code></pre>
  
  <p><strong>NB:</strong> I found out that IDM sent this information to my script</p>
  
  <ol>
  <li><p>USER AGENT:<code>Mozilla/4.0%20(compatible;%20MSIE%208.0;%20Windows%20NT%206.0;%20Trident/4.0)</code></p></li>
  <li><p>Http_referer:<code>mysite.com/api/file/JU78vhx5uh</code> (the same with the page where my video is been played).</p></li>
  </ol>
  
  <p>Please how else am I to prevent hot-linking from this software, because this website is serving free video streaming and I don't want my video downloaded.</p>