File ANTI-LEECH

Discussion in 'Site & Server Administration' started by dotCEO, Sep 23, 2009.

  1. #1
    Does anyone know a good way I can keep people from leeching files from a specific folder?

    I tried it with an .htaccess, but I'm still able to hot link content from one site to another....

    any suggestions?
     
    dotCEO, Sep 23, 2009 IP
  2. ohteddy

    ohteddy Member

    Messages:
    128
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #2
    What you want to do is verify that the HTTP_REFERER is on the same
    domain from which the images (content) is being requested. You can
    do this with any web server. The configuration to do this varies between
    webservers, so please refer to your docs.

    In Lighttpd you can do:
    
    # if referrer doesnt begin with http://www.example.org
    $HTTP["referer"] !~ "^http://www\.example\.org" {
      url.access-deny = ( ".jpg", ".jpeg", ".png" )
    }
    
    Code (markup):
     
    ohteddy, Sep 23, 2009 IP
  3. dotCEO

    dotCEO Member

    Messages:
    75
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #3
    That's amazing dude, thanks for that...

    but quick question... Do you think I could add more then just 1 domain to "ALLOW" for leeching?
     
    dotCEO, Sep 23, 2009 IP
  4. ohteddy

    ohteddy Member

    Messages:
    128
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    28
    #4
    Sure you can. In the case of the example above you can use the '|' (or operator)
    in regex to check for another domain. But as I said before every webserver is
    going to have different mechanisms to do this, so please check your webserver
    docs.
     
    ohteddy, Sep 23, 2009 IP
  5. dotCEO

    dotCEO Member

    Messages:
    75
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #5
    Since it's a virgin server that is running some files that I don't want leeched, I'm installing Lighthttpd, so I can just plug in the code you gave me... :)

    but seriously bro, I really appreciate your professionalism and help with this... now my bandwidth shall remain mine :D
     
    dotCEO, Sep 23, 2009 IP