HIya,
I'm currently using this in a .htaccess file to prevent hotlinking pictures:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://MYDOMAIN.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.MYDOMAIN.com/.*$ [NC]
RewriteRule .*\.(bmp|jpg|gif)$-[F]
but would it be also possible that if someone tries to hotlink the pictures that they get referred to my main page or any other page I specify?
Aralanthir
03-10-2002, 03:01 PM
Well, what I do for my page is to replace the hotlinked picture with another, smaller picture that contains my page's URL.
In that case, you just have to change the Rewrite Rule:
RewriteRule .*\.(bmp|jpg|gif)$ http://yoururl.com/bad.gif [R]
That *should* work. I'm not too sure on how to change it so it refers to a webpage, though.
Well, if redirecting is not working I think that's a good idea with that pic!
Thanks for that.
What happens if I redirect it to a .html file like:
RewriteRule .*\.(bmp|jpg|gif)$ http://www.mydomain.com/ripping.html [R]
???
And what would happen if I use some framebuster JS? Anyone tried this already?
wsjb78
Aralanthir
03-11-2002, 12:55 PM
If you want to test out whether your .htaccess file is working, just go to this site:
www.hotlinking.com
That should tell you whether it works or not.
I'm not entirely sure what you mean by a framebuster JS. Do you mean that you have a javascript in the ripping.html that'll bust the page out of frames?
I think that if the actual re-direction works and it leads to the ripping.html file, the framebuster JS should work as well.
prerequisit of that framebusting JavaScript would be that I can execute a HTML file that's actually a hotlinked picture...
I have to try out some time...
DjPaj
03-11-2002, 05:26 PM
K, now don't flame on me too bad, but what exactly is hotlinking? What I've been reading seems interesting, and may look like something I would want to do, if I needed too.
Well, hotlinking means someone links your ressources from their website:
e.g. www.xyz.com has a page full of images but they don't host the images there. Instead they link it like this: <img src="http://www.yourdomain.com/pics/pic1.jpg">
This means they are using your images, on your server in their homepages and you pay for the bandwidth... this can also be done with other media files.
Those apache rules we mentioned before doesn't allow to link ressources containing those .htaccess files outsite your domain.
What I'd love to do now is that if someone is hotlinking a pic of mine that they actually get redirected to my site...
Hope that helps!