PDA

View Full Version : Preventing hotlinking


torifile
2006-11-24, 21:57
I'm having trouble preventing people from hotlinking my files. Not that I care all that much, but I've tried, unsuccessfully, to keep it from happening. I'm trying to use .htaccess to do it but it's not working.


Options +FollowSymlinks
# no hot-linking
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?stevesremoteclicker\.com/ [nc]
RewriteRule .*\.(mp3)$ http://www.stevesremoteclicker.com/wp-content/uploads/audiotest.au [nc]


This is just some code I found on the net and tried to adapt. Any ideas?

Brad
2006-11-25, 01:35
I'm no expert on .htaccess rewrite rules, but I know that mine works. :p Comparing to mine, I'd suggest changing the last two lines to look like this:

RewriteCond %{HTTP_REFERER} !^http://(www\.)?stevesremoteclicker\.com/.*$ [nc]
RewriteRule \.(mp3)$ wp-content/uploads/audiotest.au [nc]

torifile
2006-11-26, 01:28
Weird. Even with your changes, it still doesn't work. This is the page I'm talking about: http://www1.investorvillage.com/smbd.asp?mb=445&mn=11333&pt=msg&mid=885034

It should play that Monty Python clip in our python installations when mp3s are hotlinked but it doesn't. The odd thing is that it did it once when going to that site for me and then never again. Any thoughts?

And, to be sure it wasn't just a cacheing problem, I tried going to that site on a computer that had never played or even loaded the hotlinked clip. (Newly formatted windows machine.)