Forum Moderators: phranque

Message Too Old, No Replies

Bandwidth stell protection: avoiding hotlinking

Hotlinking protection enabled but lots of 404

         

silverbytes

7:32 pm on Nov 2, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I checked my site from hotlinking (that's when other's link from other servers to your images using [yourserver.com...] That causes bandwith loss every time others uses your images linking from you own server.

I checked it and it's enabled so people hotlinking my images can't display those. However that makes my logs get tons of 404 errors

Example:
http://www.example.com/friend/profile/displayProfile.do?userid=blabla -> /mysite/myimage.gif

How do I stop that?

[edited by: jatar_k at 8:10 am (utc) on Nov. 6, 2006]
[edit reason] examplified [/edit]

stapel

7:32 pm on Nov 3, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What commands are you using in your .htaccess file to prevent the hotlinking? For instance, my .htaccess file uses the following structure:


    RewriteCond %{HTTP_REFERER}!^$
    RewriteCond %{HTTP_REFERER}!^http://111.222.333.444/.*$ [NC]
    RewriteCond %{HTTP_REFERER}!^http://friendlydomain.com/.*$
    RewriteCond %{HTTP_REFERER}!^http://translation_site.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER}!^http://mydomain.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER}!^http://www.mydomain.com/.*$ [NC]
    RewriteRule .*\.(jpg¦gif)$ /hotlink.png [R,NC]

What structure does yours have?

Does the "myimage.gif" file exist in the expected location?

Thank you.

Eliz.

silverbytes

8:03 pm on Nov 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



That one.
And yes images exists. (Can't delete images I'm using just because other wants to hotlink)

stapel

10:47 pm on Nov 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Obviously the targetted (hotlinked) images exist. It would be silly to delete them.

Since you're getting 404 ("file not found") errors, something is looking for some file that it isn't finding. I was asking whether the replacement image ("hotlink.png", in my example) exists.

Thank you.

Eliz.