Prevent hotlinking of images and redirection from nonexistent pages

Discussion in 'Apache' started by chazmilles, Dec 10, 2007.

  1. #1
    1. In order to save bandwidth, how can I prevent hotlinking of images?

    2. And I've seen a few sites are doing this.. any nonexisting page, 404's, get redirected to be index.

    Any help, please?
     
    chazmilles, Dec 10, 2007 IP
  2. buldozerceto

    buldozerceto Active Member

    Messages:
    1,137
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    88
    #2
    buldozerceto, Dec 11, 2007 IP
  3. hans

    hans Well-Known Member

    Messages:
    2,923
    Likes Received:
    126
    Best Answers:
    1
    Trophy Points:
    173
    #3
    since a forums sense is to give full answers and ready to use solutions, here below something ready to use - just adapt domain name or add new domains to be excluded from hotlink protection.

    in above hot link protection, the lines starting with !
    like for example

    are the sites excluded from hot link protection - such as SE image search and your own domain.

    the line with REQUEST_FILENAME
    has the file extension to be protected by hotlinking code

    you may add or remove extensions depending on your needs

    above first (top) example is part of my own original - except that I allow a few more SE than a.m.
     
    hans, Dec 14, 2007 IP
  4. Flux

    Flux Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I'm also interested on prevent hotlinking for my website and after googling I found this interesting & simple methode from altlab.com
    altlab.com/htaccess_tutorial.html

    They have hotlink checker too
    altlab.com/hotlinkchecker.php
     
    Flux, Dec 14, 2007 IP