Protect Directories

Discussion in 'Apache' started by bigrollerdave, Feb 13, 2007.

  1. #1
    I'm trying to stop people from seeing all the files in a folder. Say if you have the folder http://www.somesite.com/files/ and there isn't a index file then it will show a list of all the files in the folder. I have over 30,000 folders though and can't add a index file for each one. Is there a way to stop that via apache?
     
    bigrollerdave, Feb 13, 2007 IP
  2. nick-a

    nick-a Active Member

    Messages:
    446
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Options -Indexes in a .htaccess? I think it may work sitewide I'm not sure.
     
    nick-a, Feb 13, 2007 IP
  3. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Most efficient is to put that in your VirtualHosts section for the domain in your httpd.conf

    Otherwise just put it in the root .htaccess file and it will be inherited in all subfolders.

    (And when I say it, I mean the code nick posted "Options -Indexes")
     
    rodney88, Feb 13, 2007 IP
  4. bigrollerdave

    bigrollerdave Well-Known Member

    Messages:
    2,112
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    140
    #4
    Where exactly can I put this? Can I throw that code anywhere in my http.conf?
     
    bigrollerdave, Feb 13, 2007 IP
  5. ThreeGuineaWatch

    ThreeGuineaWatch Well-Known Member

    Messages:
    1,489
    Likes Received:
    69
    Best Answers:
    0
    Trophy Points:
    140
    #5
    It is usually within a <Directory> directive... something like:

    .
    .
    .
    <Directory /name/of/directory/to/protect>
    Options -Indexes
    </Directory>
    .
    .
    .
     
    ThreeGuineaWatch, Feb 23, 2007 IP