PDA

View Full Version : Preventing Hotlinking of Media Files


Casy
06-26-2006, 07:19 AM
Is there any way to block users from remotely downloading files on my server using an htaccess file. Basically, what I want to do is to allow users to use my website normally - so I have some wmv files on my server and I'm using the windows media player embed to show these files, what I want to do is allow users to view these files on my server when using the embedded player but if they try to play it remotely on their computer - as in entering the direct url to these from files my server - that it will not work.

With htaccess you can prevent people from hotlinking your images, but I'm wondering if this is possible for other formats - like wmv, it should work in theory but the problem is that I want the user to be able to view these wmv files when using my site's embedded player.

In Summary:
using the embeded player on my site --> works
hotlinking the direct wmv file in realplayer or windows media player-->won't work.

Thanks :) :thumbsup:

_Aerospace_Eng_
06-26-2006, 07:33 AM
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://yoursite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://yoursite.com$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yoursite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.yoursite.com$ [NC]
RewriteRule .*\.(jpg|jpeg|gif|png|bmp|wmv)$ - [F,NC]
Just add the extension you want blocked at the bottom seperating them with a |.