Forum Moderators: phranque

Message Too Old, No Replies

Prolem with blocking music file hotlinking

rewrite rules for .mp3, .rm, .wma and so on

         

philipsXXLB

2:46 pm on Dec 16, 2006 (gmt 0)

10+ Year Member



I have a piece of code like this to play music automatically on my website <embed src='http://upav.aaaa.com/newattach/20/538/0/lzhd.wma' autostart='true' width='300' height='60' loop='1'></embed>

I have used mod_rewrite and sucessfully block image hotlinking, but I don't know how to block such kind of music files' hotlinking. Because when I try to use the same rule, these files cannot be played on this embed code either.

Anybody can help me out with this?

Thanks very very much for your help!

jdMorgan

3:11 pm on Dec 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Referrer-based access control won't work for "playable" media files, because most players do not send an HTTP Referer header.

You'll need a script-based solution: For example, a script that checks a short-term cookie set by one or more of your HTML pages, and then "includes" and sends the media file only if that cookie is set.

There may be some off-the-shelf scripts available for this; I don't know, but it's worth a look.

Jim

philipsXXLB

5:57 pm on Dec 16, 2006 (gmt 0)

10+ Year Member



Thanks very much for your reply. But I did not get it. Can you please explain more on this? Thanks very very much!

It is really a big headache for me.

philipsXXLB

2:05 pm on Dec 17, 2006 (gmt 0)

10+ Year Member



Because I am using tomcat working together with the apache server, the hosting company suggests me to use a servlet filter to solve this problem. Can anybody give the idea of how to write the servlet filter program? I means what's the difference between the accessing source, from my embed code, and from outside?

Thanks very much!