Web Hosting Talk







View Full Version : stopping hotlinking.


C.P
02-08-2002, 12:46 PM
My host uses a cobalt raq4 as their server. Now I'm trying to stop hotlinking to my site. So I added this .htaccess file with this code in. For some reason this code doesn't work at all. Well it works sort of but it kills the pictures on my site too.
Is this code correct??


RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://domain name/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domain name/.*$ [NC]
RewriteRule .*\.(bmp|jpg|gif|zip|mp3|mid|)$ http://www.domain name [NC,R]


The code above works on my old host but for some reason it doesn't seem to work on cobalt raq4 server. What's wrong here?

C.P
02-09-2002, 05:10 AM
cough...cough.... bump..;)

Pingu
02-09-2002, 09:28 AM
Well, here's my .htaccess, working an a raq3:

RewriteEngine on
RewriteOptions inherit
RewriteCond %{HTTP_REFERER} !http://mysite.com/
RewriteCond %{HTTP_REFERER} !http://www.mysite.com/
RewriteCond %{HTTP_REFERER} !http://123\.234\.345\.456/
RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ http://www.mysite.com/nonono.jpg

C.P
02-09-2002, 11:34 AM
[Jj][Pp][Gg]?? What does that stand for?? I'll have to try yours out and see if that work. Mine should work but it doesn't. It just kills my images as well.

Pingu
02-09-2002, 02:56 PM
It's upper and lowercase jpg and gif

amaya
03-02-2002, 03:03 PM
I tried the above code, and it didn't work at all. I'm having the same problem. It blocks all the images even from your own server. Is there another way to stop hotlinking on a Raq? If not, I'm going to have to find another host... Again.

Thanks for any help!

Amaya

GideonX
03-02-2002, 03:12 PM
the above code works fine. paste what you have here and we'll see what you did.

btw..i hope you changed those settings to reflect your own.

gertiebeth
03-07-2002, 11:58 PM
Originally posted by Pingu
Well, here's my .htaccess, working an a raq3:

RewriteEngine on
RewriteOptions inherit
RewriteCond %{HTTP_REFERER} !http://mysite.com/
RewriteCond %{HTTP_REFERER} !http://www.mysite.com/
RewriteCond %{HTTP_REFERER} !http://123\.234\.345\.456/
RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ http://www.mysite.com/nonono.jpg

Will this also work for video files like Real media, Windows Media, MPEG, AVI, etc? And if so, when someone tries to play the file from a remote location, will http://www.mysite.com/nonono.jpg show up in the browser, or will it show up as a 404?

Thanks in advance!!