albertldee

Member
May 10, 2003
20
0
151
i put the .htccess file i created in the directory it block jpg, jpeg, gif extension but it doesn't block wmv or asf extension/video
this is what i have

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com/forums(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?friendsite.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|wmv|asf|mpg)$ - [F,NC]

cPanel.net Support Ticket Number:
 

newfield

Active Member
Mar 2, 2002
38
0
306
State of Confusion
Originally posted by albertldee
i put the .htccess file i created in the directory it block jpg, jpeg, gif extension but it doesn't block wmv or asf extension/video
this is what i have

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com/forums(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?friendsite.com(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|wmv|asf|mpg)$ - [F,NC]

Try removing the minus sign in your RewriteRule:
change the last line:

RewriteRule .*\.(gif|jpg|jpeg|bmp|wmv|asf|mpg)$ - [F,NC]

to this:
RewriteRule .*\.(gif|jpg|jpeg|bmp|wmv|asf|mpg)$ [F,NC]

It's a stab in the darkorb, but, I don't recall any parameters for the minus sign where you have it.

http://www.apacheref.com/ref/mod_rewrite/RewriteRule.html

cPanel.net Support Ticket Number:
 

Crazy Pete

Well-Known Member
May 16, 2003
55
0
156
If you mean people can just put the direct url to a video file and download it, it's because you have this line in there...

RewriteCond %{HTTP_REFERER} !^$

That line allows blank referrer headers, which is what happens when someone types in a direct link, or has them disabled via their browser or some sort of firewall. I have them disabled because I don't want direct links to go through at all, and if people have a firewall or whatnot I just tell them how to enable referrer headers being sent.

If you remove that line I bet it'll work the way you're thinking it should.

cPanel.net Support Ticket Number:
 

albertldee

Member
May 10, 2003
20
0
151
thanks everyone
by the way i'm albert

i try all the info above and they work in one area but not the other which is embeded

i have a small board like this and with the video embeded in the post

<embed src="http://mysite.com/instructionvideo.wmv" autostart="false" controls="true" loop="false" width="320" height="280"></embed>

they hotlink the my video by embeding it in their forum once you click on play 2 time it will begin playing, how can i stop that

otherwise everything else work fine
thanks everyone

cPanel.net Support Ticket Number:
 

Website Rob

Well-Known Member
Mar 23, 2002
1,504
1
318
Alberta, Canada
cPanel Access Level
Root Administrator
I think it's more to do with the coding itself. I have seen others have problems as well, when using:

RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com(/)?.*$ [NC]

Keep it simple and use:

RewriteCond %{HTTP_REFERER} !^http://mysite.com.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.mysite.com.*$ [NC]

Sure, you use two lines instead of one, but I'll bet (any flavour of doughnut) the problem goes away. ;)


Also, with regards to the last line, although the dash is not usually a problem, I recommend using [F,L] instead. As you already know, whether you use Upper or Lower case for your file extensions, using NC is not necessary.
 
Last edited: