Wmv and .htaccess


#1

Hi all,

I’ve managed to successfully embedded wmv files on to my pages and appear to play as they are downloading but as soon as I place a .htaccess file the wmvs won’t load.

I have the following in the .htaccess file:

RewriteEngine On

RewriteCond %{HTTP_REFERER} !^http://www.mydomain.com/
RewriteCond %{HTTP_REFERER} !^http://mydomain.com/

I would appreciate any help I can get as I want to be able to stop people from hot-linking my video files and at the same time have my videos load.

Thanks


#2

It should look something like the following:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?example.com/.*$ [NC]
RewriteRule .(wmv)$ [F]

Silk


#3

Thanks,

Should it be:
RewriteCond %{HTTP_REFERER} !^http://(www.)?mydomain.com/.$ [NC]
or
RewriteCond %{HTTP_REFERER} !^http://(www.)mydomain.com/.
$ [NC]

can I also add to the bottom:
RewriteRule .* http://mydomain.com/protected.htm

…if i want to divert traffic here?


#4

I beleive you will need to add the [R] at the end for a redirect.
Not sure about multiple rules.
This cheat sheet should help. http://www.ilovejackdaniels.com/cheat-sheets/mod_rewrite-cheat-sheet/
Edit: sorry didn’t read your post correctly. If I remember right, the ? means anything in the ( and ) is optional.
Silk


#5

Sorry, I am a bit lost. This is what I’m actually trying to do:

mydomain.com/members directory is protected and I allow two domains to link or go directly here. At the same time I need to allow videos to be downloaded or stream from that directory. I also need the surfer to be re-directed to a specific page if they try to access the directory directly.

At this stage with the codes given all that’s happening is I get re-directed to specified page, no matter what.

Please help me out, the cheat code link is too confusing. Sorry, and thanks.


#6

If I follow you correctly, you can place the rewrite rule either in the same directory as your webpage or a parent directory but I beleive it still has to be in that domain.
Odds are where you are trying to put it now is ok.
Now the directory where your videos are, you can either add another htaccess file, that can have a redirect in it.
Try this
RewriteEngine On
RewriteRule ^.wmv$ http://www.example.com/error.html[R,L]

Whether this will block your own page, I am not sure right now as this is a theory. It may be necessary to add a condition that states not your webpage.
Also, I am not sure if adding the rewrite engine in a subdirectory is necessary since it is already on in the parent directory.
Silk