PDA

View Full Version : How do I prevent image hotlinking


darksaber76
07-30-2004, 03:43 PM
I know this is in the Hostrocket FAQ, but I am really confused. It's not been a problem for me so far, but I don't want to take any chances. On other webhosts the prevention of hotlinking was automatically there, so I don't know how to do it. It has something to do with .htaccess?? How do I prevent Hotlinking on my images without using a 'No right click' script? Anyone know that can explain it to someone who has limited coding knowledge? Maybe it can't been done with a free account on Hostrocket?? I don't know. Just wondering if anyone can help me.

Thanks

Silmaril8n
07-30-2004, 05:28 PM
Heres a copy of my anti-leach code from my .htaccess file. I have it sitting in my images directory. This won't prevent users from "right-clicking" and saving images though - nothing can truly do that...

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?artisans-fair.org(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?images.artisans-fair.org(/)?.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?forums.artisans-fair.org(/)?.*$ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|png)$ http://pub.artisans-fair.org/leach.gifs [R,NC]