Welcome to WebmasterWorld Guest from 23.22.140.143

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

mod rewrite and wmv files

     
10:04 am on Sep 15, 2003 (gmt 0)

New User

10+ Year Member

joined:Sept 15, 2003
posts:1
votes: 0

I am trying to prevent hotlinking of my windows media movies, .wmv files. I used the following code:

Rewriteengine on
RewriteCond %{HTTP_REFERER}!^http://domain.com/.*$ [NC]
RewriteCond %{HTTP_REFERER}!^http://www.domain.com/.*$ [NC]
RewriteRule \.(wmv)$ - [F]

The problem seems to be that the windows media player is accessing the file from a domain other than mine, its own domain, so I am blocked from getting the file even if coming validly from domain.com... does that make sense? Is there a way around this?

5:47 pm on Sept 16, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Aug 20, 2003
posts:255
votes: 0


Welcome to WebmasterWorld [webmasterworld.com], benway!

You may want to check your server's logs. When I try accessing files with WMP, it shows no referer. You'll have to add an extra RewriteCond to account for that.

Added:
Now that I've thought about it, mod_rewrite probably isn't the way to tackle this problem. You may want to consider other ways of restricting access to your files. Password protection maybe?

6:44 pm on Sept 16, 2003 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:5808
votes: 64



WMP copies files to it's own play list. That's why you can still play them from your desktop without being connected to the internet. If you freely offer media files on your website, there's no way you can prevent WMP from making it's own copy. By forbidding remote referrers for .wmv, you are not allowing WMP to operate the way it's set-up to work.
7:51 pm on Sept 16, 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


Allowing blank referrers will probably fix this problem.

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?domain.com/ [NC]
RewriteRule \.wmv$ - [F]

It does open a hole in the protection, but allows WMP to work properly.

Jim

9:30 pm on Sept 16, 2003 (gmt 0)

Full Member

10+ Year Member

joined:Aug 20, 2003
posts:255
votes: 0


That's what I thought, Jim, but I think everyone would have a no referer. That's why I think it won't work.