Forum Moderators: phranque

Message Too Old, No Replies

Trying to prevent swf hotlinking

         

uberslacker

3:15 am on Feb 9, 2006 (gmt 0)

10+ Year Member



Here's a topic that I haven't seen a ton of info on. I'm trying to prevent hotlinking of my swf files. They are in a directory called soundboards on my server. I have an htaccess file in that folder. I have tried putting lots of different thingsin that file. What I have right nowis:

RewriteEngine on
RewriteCond %{HTTP_REFERER}!^$
RewriteCond %{HTTP_REFERER}!^http(s)?://(www\.)?mysite.com [NC]
RewriteRule \.(jpg¦jpeg¦png¦gif¦swf)$ - [NC,F,L]

Using [a hotlink testing tool] I can still see the swf file. I've tried hard but I can't seem to prevent the darn swf files from being hotlinked. Any ideas? Is there something special about swf files that makes this not work?

[edited by: jdMorgan at 3:45 am (utc) on Feb. 9, 2006]
[edit reason] No URLs please. See TOS. [/edit]

jdMorgan

3:44 am on Feb 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check your raw log file, and see if the shockwave player provides a referrer -- Many media player don't, and that rather blows a hole in referrer-based hotlink prevention.

Jim

milanmk

4:34 am on Feb 9, 2006 (gmt 0)

10+ Year Member



RewriteCond %{HTTP_REFERER}!^$ [OR]

Try this and it should work fine.

jdMorgan

5:54 am on Feb 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm sorry, but no, [OR] won't work fine with these combined negative patterns...

Changing from the implied [AND] to [OR] would change the logic to say, "Block if ( (the referrer is NOT blank) OR (the referrer is NOT the home site) )", a logical combination which would always evaluate to TRUE, and thus always block access.

Jim