View Single Post
Old 2004-11-08, 04:55 PM   #29
stev0
You tried your best and you failed miserably. The lesson is 'never try'
 
stev0's Avatar
 
Join Date: Mar 2004
Location: Calgary
Posts: 165
Send a message via ICQ to stev0
This is what I use and it works with my wmv files...

.htaccess file

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://([a-z0-9-]+\.)*yourdomain.com(:80)*/ [NC]
RewriteCond %{HTTP_REFERER} !^http://([a-z0-9-]+\.)*anyotherreferingdomain.com(:80)*/ [NC]
RewriteCond %{HTTP_COOKIE} !(^|(.+*)id=valid(;.*|$)
RewriteRule /* http://www.picz.ca/notice.html [R,L] )


Then here's the trick to get it working with wmv's or any file for that matter.

Put this in the head of the html file that your visitors will see (with the videos on it).

<SCRIPT LANGUAGE="javascript">
// Calculate the expiration date
var expires = new Date ();
expires.setTime(expires.getTime() + 24 * 60 * 60 * 1000);
document.cookie = "id=valid; path=/" + "; expires=" + expires.toGMTString();
</SCRIPT>


That javascript will make a cookie (which is one of the rewritecond's in the htaccess file). So even though the wmv file doesnt show a referal, the surfer that was at that page will have that cookie and therfore can download the wmv file.

Last edited by stev0; 2004-11-08 at 04:59 PM..
stev0 is offline   Reply With Quote