Prevent hotlinking to music files?


I’ve done a search on google and on the kb and forums for dreamhost on the topic of hotlinking. I’ve seen a couple of replies on editing the .htaccess file to prevent hotlinking to image files. But is there any way to prevent it for hotlinking to media files? like .wav or .wma or etc? And how would you configure the file so as to allow hotlinking from a particular site, say someone’s xanga? Any help would be appreciate. Thanks :slight_smile:


You could try adding this to the htaccess file in or above your music folder…

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www.)?
$ [NC]
RewriteRule .*.(wav|wma|asx)$ - [F]

HTML Basix has an awesome htaccess code generator, along with great information on this (including a note about music files). The link is