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 to use .htaccess deny direct download my file

Discussion in 'Apache' started by alex641230, Mar 10, 2011.

  1. #1
    i use this

    RewriteRule .*\.(jpg|jpeg|gif|png|bmp|flv|avi)$ - [F,NC]

    but still can direct download my file
    how do i edit it ?
    thank you
     
    alex641230, Mar 10, 2011 IP
  2. Natcoweb

    Natcoweb Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    <FilesMatch "\.(gif|jpg|jpeg|flv|png)$">
    Order Allow,Deny
    Deny from all
    </FilesMatch>
     
    Natcoweb, Mar 11, 2011 IP
  3. alex641230

    alex641230 Greenhorn

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    i try it
    but still can download
     
    alex641230, Mar 11, 2011 IP
  4. alex641230

    alex641230 Greenhorn

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #4
    because i also use nginx
    so i still can download my file
    when i remove nginx
    this setup can work
    but if i want let all can't download,only xxx.com can download
    what can i do ?
    thank you
     
    alex641230, Mar 12, 2011 IP
  5. Natcoweb

    Natcoweb Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Seems like rules from your access file are not being applied. Please provide the the full definition of appropriate Directory directive from your server's configuration.
     
    Natcoweb, Mar 14, 2011 IP
  6. alex641230

    alex641230 Greenhorn

    Messages:
    80
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #6
    in this file
    i can deny download
    but i want xxx.com
    can downlod my file
    what can i do
     
    alex641230, Mar 15, 2011 IP
  7. Natcoweb

    Natcoweb Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    In nginx configuration file:

    location ~* ^.+\.(flv|jpg|jpeg|png)$ {
    root <your_direcrory_with_stuff>
    allow from xxx.com
    deny from all
    }
     
    Natcoweb, Mar 18, 2011 IP