Welcome to WebmasterWorld Guest from 34.204.173.36

Forum Moderators: Ocean10000 & phranque

Message Too Old, No Replies

Preventing Hotlinking of WMV files

     
4:10 pm on Dec 12, 2003 (gmt 0)

New User

10+ Year Member

joined:Dec 12, 2003
posts:5
votes: 0


I am new here and would appreciate any help with this issue....

I have set up a full lenght movies site and am trying desperately to prevent hotlinking of my WMV files to no avail.

When I remove the blank referrer from my htaccess file the redirect no longer works... if i leave it in the hotlinking can continue.

The last attempt consisted of:

RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_REFERER}!^http://sub.sitename.net/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.sub.sitename.net/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://xx.xx.****.xx/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^https://sub.sitename.net/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^https://www.sub.sitename.net/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^https://xx.xx.xxx.xx/.*$ [NC]
RewriteRule .*\.(bmp¦gif¦GIF¦jpg¦JPG¦exe¦zip¦mpeg¦avi¦mpg¦wmv)$ - [F,L]

I have no idea how to get this working but would welcome any constructive help.

Kevin

6:01 pm on Dec 12, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


> When I remove the blank referrer from my htaccess file the redirect no longer works... if i leave it in the hotlinking can continue.

Yes, unfortunately, HTTP referrers are not reliable. They are dropped by proxies, by corporate firewalls, and by software such as Norton Internet Security.

If you block blank referrers, some portion of your legitimate user base will find themselves blocked.

There is no easy recourse to this problem, except to password-protect the file, or to rename the file once a week to break the hot-links. Be careful - use a 'fix' that does not *require* JavaScript; Otherwise, you'll block another group of legitimate users.

Somewhat-related previous thread [webmasterworld.com]

Jim

P.S. As noted elsewhere, you can combine your "www" and "non-www" hostname checks like this:


RewriteCond %{HTTP_REFERER} !^http://(www\.)?sub.sitename.net [NC]

(Anchored subpatterns like "^.*" and ".*$" are redundant - You can leave them off)
7:23 pm on Dec 13, 2003 (gmt 0)

New User

10+ Year Member

joined:Dec 12, 2003
posts:5
votes: 0


Thanx Jim for the insight.

What we have ended up with is a rather nice way of creating self expiring randomly generated hidden sub-directories inside of folders which seems to work, combined with the use of some headers to control content caching.

10:10 pm on Dec 13, 2003 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
posts:25430
votes: 0


Very good - that's a good way to do it. Glad you remembered to address the caching issues!

Jim