View Full Version : How to prevent hot-linking of images/files by other sites?
jrichrds 11-08-2000, 06:25 PM eva2000.com wrote in another thread "if you do get a dedicated server, make sure your setup a mod rewrite to prevent people from hot linking your images to other sites. Otherwise bandwidth could cost you alot. "
I was wondering whether anything could be done about this in a shared environment on Cobalt RaQ4s. .htaccess? CGI?
eva2000 11-08-2000, 07:18 PM here ya go :)
http://faq.solutionscripts.com/misc/hot_linking.html
jrichrds 11-08-2000, 07:32 PM Thanks for the link eva2000.com! :)
Setting up mod_rewrite looks a lot easier than I thought. I have a couple questions though:
"Mod_rewrite will only work with the apache server, if you are running something other than apache, this will not work. This tutorial also assumes the mod_rewrite has been compiled and installed on your server."
Do the RaQ4r's qualify?
"Save this .htaccess file and upload it to the directory on your server containing the images, or any folder lower than that directory."
Does this mean it'll only affect the image files in the folder in which the .htaccess was placed? How about subfolders of that folder? Do I have to upload an .htaccess file to each one as well?
Tim W 11-08-2000, 09:29 PM raqs use a Apache, so yes it will work.
It will affect the folder it is placed in and all its subfolders. The subfolders will not need their own .htaccess file
jrichrds 11-08-2000, 10:25 PM Thanks guys. :)
that looks easy i thought it would be harder than that why don't all host use this? one question though what do you CHMOD the .htaccess file to.
Do you know of a way to stop people from downloading your hole site to there hard drive using off line viewers? I seen a script for this but they wanted 50 bucks for it and it used .htaccess
KDAWebServices 11-09-2000, 11:30 AM As far as I know there is no way of stopping people downloading your whole site as a web browser would see it. If a web browser can see it then so can an offline reader as most of them can be set to imitate one of the common web browsers out there.
chilliboy 11-10-2000, 05:21 AM Interesting - I never knew it was possible to download a 'whole' site.
Is it possible to download their backend code?
If anyone can tell me how to do this I would be grateful. Its not that I want to steal peoples code, its just that I would be interested in seeing how a few sites do things - in much the same way as you look at sites html code.
I'd be grateful if anyone could tell me how to do this.
Cheers.
You can not view sites backends. These "backends" simply spit out html dynamically, like these forums. If you try to save it, you just save the html that is spit out to you.
Tim's correct. However, there are some programs which allow you to specify which sites to download and how many 'levels of links' you want to go down. Do a search for 'web fetching or download sites' programs on Download.com and you'll find a few.
Technically if you wanted to view ASP and CF code there's a few sneaky ways of doing it, but I'm not sure about other languages like PHP.
jrichrds 11-14-2000, 09:51 PM I just gave mod_rewriting a try (exactly as specified on that web page), and it didn't work (Cobalt RaQ4r). Shucks.
Félix C.Courtemanche 11-15-2000, 12:07 AM the following does work on a raq3i:
(3 examples)
# ----------- Anti Leach
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.domain.com/.*$ [NC]
RewriteRule .*\(gif|GIF|jpg|JPG)$ - [F]
#
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://www.domain.com/.*$ [NC]
RewriteRule .*\(gif|GIF|jpg|JPG)$ - [F]
RewriteEngine on
#
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http://www.domain.com/.*$ [NC]
RewriteRule .*\(gif|GIF|jpg|JPG)$ http://www.domain.com [R]
jrichrds 11-15-2000, 12:29 AM Yay! I tried the last one of Félix's examples and it worked.
Thanks Félix!
Matt Lightner 11-15-2000, 12:41 AM Hmm... I've seen a few programs that do exactly that for about $100.
Excellent tips eva/felix!
Matt
mlightner@site5.com
miami_g 11-15-2000, 07:45 AM I run a large greeting card site and have had leeches for about 6 months. this a.m. i added the .htaccess file to my images dir and routed it to a quite nasty image
it works......my hot leeches will get quite a surprise today
THANKYOU VERY MUCH
Chicken 11-15-2000, 10:17 AM HA! Right-on right-on!
jamesglewisf 03-10-2001, 12:50 AM I have tried every one of felix's variations on my Alabanza server, and each one blocks my site from using the smilies also. I'm going nuts. Any ideas?
easypooltutor 03-12-2001, 03:36 PM I tried the script and it's pretty cool. Thank you web gurus for this very useful info.
[Edited by easypooltutor on 03-12-2001 at 02:50 PM]
Vladimir 03-17-2001, 05:36 PM Just one thing : if you have no posession of .htaccess files, you may find this useful - http://yasd.dhs.org/en/angod.php3
Also can add a javascript to prevent right-clicking on images to save 'em ;)
projo 03-17-2001, 07:52 PM Considering a super-set of the image-linking problem. I just looked into software that protects your page source as well as preventing hot-linking (as I understand it). It costs about $20.
Webcrypt 2000 encrypts everything from body to /body and appears to use javascript to pass the page to the browser on the fly. As a result the source does not exist in a readable form, either on the client or on the server.
If you take a look please correct my impression as appropriate.
Gary
(Edit note: removed the < and > around body as VB did not like it at all.)
Chicken 03-18-2001, 01:33 AM Gary, I have a link *somewhere* in my somewhat unorganized plethora of fav's that does the same thing. I can't find it, so I know that doesn't help, but it sounds like ti did the same thing.
Javascript in combination with changing every character into an unreadable mush. Maybe hex values (is that only for colors, heh?). What is it called when you change characters like @ to &4656; bahhhh... ignore me, I'm typabbling...
kunal 03-18-2001, 02:46 AM why cant one just use http referer and php?
nisus 03-18-2001, 10:27 AM This post's been a great help..
My stats are filled with multimedia.lycos.com
and multimedia.alltheweb.com. I tried the search
engines and my images are plastered all over!
I'm gonna add the .htaccess idea now with a nice
nasty image replacement and see how those search
engines look!
Thankyou!
Vladimir 03-18-2001, 11:50 AM Heh, surely, why not to give out pages in URL-encoded format ? (that %20%3B%EA etc weird characters ;)) And add some kind of javascript to disable clicking and selecting all the text, or right-clicking-and saving... i've said this before. holy Jesus, that site will become some kind of PDF-like thingie - you can read it, but you can't change it, or even see, what's inside ;)
|