1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How do I protect from hotlinking?

Discussion in 'Site & Server Administration' started by ~kev~, Mar 17, 2009.

  1. #1
    What is the best way to protect images from hotlinking? And not just images, but maybe the entire site?

    I have a forum that a lot of people have uploaded images to. So I would like to protect the images directory from anyone trying to hotlink to the files. The directory index is protected by a blank index.html file. But if someone knows the url to the image, it can be hotlinked.
     
    ~kev~, Mar 17, 2009 IP
  2. SSANZ

    SSANZ Peon

    Messages:
    861
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hotlinking protection, if your using cPanel its a feature already available
     
    SSANZ, Mar 17, 2009 IP
  3. ~kev~

    ~kev~ Well-Known Member

    Messages:
    2,866
    Likes Received:
    194
    Best Answers:
    0
    Trophy Points:
    110
    #3
    When I activated hotlink protection through cpanel, there was some kind of error about an .htaccess in the apache directory and the site crashed with an Internal Server Error message. So I had to disable hotlink protection to get the site back online.

    I submitted a ticket to support for them to look into the problem. But until I get a reply from them, I would like to know what my other options are.
     
    ~kev~, Mar 17, 2009 IP
  4. kailash

    kailash Well-Known Member

    Messages:
    1,248
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    190
    #4
    kailash, Mar 19, 2009 IP
  5. piratesbi

    piratesbi Peon

    Messages:
    433
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    You can directly generate it using .htaccess file. Just create a code from below link:


    http://www.htmlbasix.com/disablehotlinking.shtml


    but my problem is that Thumbnail also get hotlink protected. How to avoid this?

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?exbii.com(/)?.*$     [NC]
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?google.com(/)?.*$     [NC]
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?gmail.com(/)?.*$     [NC]
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?masti.s4.bizhat.com(/)?.*$     [NC]
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?dadesiforum.com(/)?.*$     [NC]
    RewriteRule .*\.(gif|jpg|jpeg|bmp)$ http://i43.tinypic.com/2ennhj7.jpg [R,NC]
    
    
    
    Code (markup):
     
    piratesbi, Mar 31, 2009 IP
    ~kev~ likes this.
  6. onehundredandtwo

    onehundredandtwo Guest

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Check your Apache logs for sites that are hotlinking. Change the images on your own site every now and then and change the old images to something mean. That way the other webmasters won't mess with you again. :cool:
     
    onehundredandtwo, Apr 14, 2009 IP
  7. ~kev~

    ~kev~ Well-Known Member

    Messages:
    2,866
    Likes Received:
    194
    Best Answers:
    0
    Trophy Points:
    110
    #7
    This might sound like a good idea, but I have a forum and my members have uploaded thousands of images. It would be almost impossible to edit the image name, then go back to the thread where the image is at and then edit the post.

    I tried the .htaccess file suggestion, but it seems that some of my members, their isp might use a caching server. Because several members were not able to see the images, not even the post reply button or avatar.
     
    ~kev~, Apr 15, 2009 IP
  8. seoemporium

    seoemporium Well-Known Member

    Messages:
    947
    Likes Received:
    22
    Best Answers:
    0
    Trophy Points:
    108
    #8
    seoemporium, Apr 18, 2009 IP
  9. ~kev~

    ~kev~ Well-Known Member

    Messages:
    2,866
    Likes Received:
    194
    Best Answers:
    0
    Trophy Points:
    110
    #9
    Thank you, but I do not use microsoft internet information server. I run my websites on Linux.

    :)

     
    ~kev~, Apr 18, 2009 IP
  10. onehundredandtwo

    onehundredandtwo Guest

    Messages:
    56
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Look in your logs for referrer headers. If the image has a referrer header that isn't from your own site then it is being hotlinked. If you visit the site you could ask their webmaster to stop.

    If you really wanted to you could create a script that displays a different image for that domain if it is found in the referrer.
     
    onehundredandtwo, Apr 18, 2009 IP