Forum Moderators: phranque
Here are the contents of the .htaccess file that allowed me to block access to my images and my audio files:
AuthUserFile /dev/null
AuthGroupFile /dev/null
RewriteEngine On
RewriteCond %{HTTP_REFERER}!^http://www.your_domain.com/
RewriteCond %{HTTP_REFERER}!^http://your_domain.com/
RewriteCond %{HTTP_REFERER}!^http://your_ip_address/
RewriteRule /* [your_domain.com...] [R,L]
Does anyone know how to block direct access to flash files and video files (mainly .wmv files) via an .htaccess file?
your .htaccess-code will redirect any request to your site on anykind of file to your homepage if the visitor came from 'outside'. so this will do the job like you need it.
anyway if it's not working for you, there is a thread about blocking images [webmasterworld.com] with a sample .htaccess file at the bottom. even it's about images only, you can easily extend it for other file-types. additionally it shows how to display a 'do not hotlink' picture instead of the file. if you use a .jpg for this, windows media player will show it (since v6.4). so .wmv hotlinking will lead to this picture.