![]() |
How can I protect my images from beeing hotlinked?
Hey guys, I just saw some traffic coming from http://board.freeones.com, where I found a link to a gallery of mine. I believe there're also other posts, but pointing directly to the images, any suggestion how should I protect myself from hotlinking?
I can use .htaccess to protect based on the HTTP referer and if the click is not from my site it will return 404, is this good enough? |
Yes, that's fine OR you can redirect the hotlinkers to somewhere useful.
I just use hotlink protection on a lot of my domains, some I redirect like this one: ###HOTLINKING BEGIN RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://thissite.com.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.thissite.com.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://thissite.com:80.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.thissite.com:80.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://othersite.com.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.othersite.com.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://othersite.com:80.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://www.othersite.com:80.*$ [NC] RewriteCond %{HTTP_REFERER} !^http://1.2.345.678.9.*$ [NC] RewriteRule .*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ http://www.someplacetoredirect404.co...MOVE/NO_NO.gif ###HOTLINKING END |
Code:
###HOTLINKING BEGIN Fewer rules = better, however, there are certain regexp rules that take more processing than chained rules. anchored matches are always better |
I dunno. I've run millions and millions of hits across it with no trouble.
First, mod-rewrite is voodoo. If it works like it's supposed to work, then I leave it be. I guess he could go to apache.org and write his own .. :) I'm no Apache tech. :) |
OK here's what I've put there:
###HOTLINKING BEGIN RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://www.free-pussysite.com [NC] RewriteCond %{HTTP_REFERER} !^http://free-pussysite.com [NC] RewriteRule .*\.([Jj][Pp][Gg]|[Gg][Ii][Ff])$ http://www.free-pussysite.com/404.html [R,L] ###HOTLINKING END It doesn't work, can you point me the errors. I'm too lazy to read mod_rewrite manual trying to figure out why it's not rewriting ;) In the same time, Apache is not returining "Internal Server Error" messages. Any ideas? |
Quote:
One thing, you cannot send hotlinkers like this: RewriteRule .*\.([Jj][Pp][Gg]|[Gg][Ii][Ff])$ http://www.free-pussysite.com/404.html You have to send them to an image, like I did. Not to a page ".html". NOW, here's the trick. That "image" is on a different domain IN a folder with .htaccess IN the folder which redirects 404. That image does NOT exist, thus, it's a 404 image and redirected by .htaccess to a page anywhere I chose. AST |
All times are GMT -4. The time now is 02:31 PM. |
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc