Greenguy's Board


Go Back   Greenguy's Board > Link Lists & Getting Listed
Register FAQ Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 2005-01-13, 11:44 PM   #1
ClickBuster
I'm normally not a praying man, but if you're up there, please save me Superman!
 
ClickBuster's Avatar
 
Join Date: Dec 2004
Location: Bulgaria
Posts: 476
Send a message via ICQ to ClickBuster
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?
__________________
The tendency is to push it as far as you can
-- Fear and Loathing In Las Vegas
ClickBuster is offline   Reply With Quote
Old 2005-01-14, 12:09 AM   #2
Adult Traffic
Pay No Attention To Me, I Am Insane
 
Adult Traffic's Avatar
 
Join Date: Apr 2003
Location: Maya Caribe. Encima de la playa blanca.
Posts: 444
Send a message via ICQ to Adult Traffic
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
Adult Traffic is offline   Reply With Quote
Old 2005-01-14, 12:19 AM   #3
cd34
a.k.a. Sparky
 
cd34's Avatar
 
Join Date: Sep 2004
Location: West Palm Beach, FL, USA
Posts: 2,396
Code:
###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://othersite.com [NC]
RewriteCond %{HTTP_REFERER} !^http://www.othersite.com [NC]
!^http://1.2.345.678.9[NC]
RewriteRule .*\.([Jj][Pp][Gg]|[Gg][Ii][Ff])$ http://www.someplacetoredirect404.c...EMOVE/NO_NO.gif  [R,L]
###HOTLINKING END
First, you don't need the .*$ at the end, that requires an end of line match anchor which just wastes regexp processing. Even with your existing rules, your first rule would have also matched your third rule with the :80.*

Fewer rules = better, however, there are certain regexp rules that take more processing than chained rules.

anchored matches are always better
__________________
SnapReplay.com a different way to share photos - iPhone & Android
cd34 is offline   Reply With Quote
Old 2005-01-14, 12:26 AM   #4
Adult Traffic
Pay No Attention To Me, I Am Insane
 
Adult Traffic's Avatar
 
Join Date: Apr 2003
Location: Maya Caribe. Encima de la playa blanca.
Posts: 444
Send a message via ICQ to Adult Traffic
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.
Adult Traffic is offline   Reply With Quote
Old 2005-01-14, 03:21 AM   #5
ClickBuster
I'm normally not a praying man, but if you're up there, please save me Superman!
 
ClickBuster's Avatar
 
Join Date: Dec 2004
Location: Bulgaria
Posts: 476
Send a message via ICQ to ClickBuster
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?
__________________
The tendency is to push it as far as you can
-- Fear and Loathing In Las Vegas
ClickBuster is offline   Reply With Quote
Old 2005-01-14, 08:52 AM   #6
Adult Traffic
Pay No Attention To Me, I Am Insane
 
Adult Traffic's Avatar
 
Join Date: Apr 2003
Location: Maya Caribe. Encima de la playa blanca.
Posts: 444
Send a message via ICQ to Adult Traffic
Quote:
Originally posted by ClickBuster
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?
Well, I suppose it's be just about as easy to copy what I posted there that is known to work and not modified to something different, but that's your decision I guess.

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
Adult Traffic is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:55 PM.


Mark Read
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc