Hide or Block Apache default directory listing

Discussion in 'Apache' started by apsam29, Dec 22, 2008.

  1. #1
    One of my webiste having trouble in blocking Apache forced directory listing for some folder/dir files. :confused:
    Now I need to close for public visitors of my website, can anyone tell me Is there any options to block or hide these default directory listing problems?
    If you have any short code or script to do this.:D

    Dont tell me to create index.php for these directories :(, sugg.me from Apache side blocking.
     
    apsam29, Dec 22, 2008 IP
  2. HSH

    HSH Peon

    Messages:
    73
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    If you can access the httpd.conf file for that website, make sure that you have set very strict permissions on EVERYTHING, then modify individual directories. Your first <Directory> statement should look like this:

    <Directory />
    Options Includes FollowSymLinks
    AllowOverride None
    </Directory>

    For any directory that you want more relaxed permissions on, make a specific directive for it.
     
    HSH, Dec 22, 2008 IP
  3. joebert

    joebert Well-Known Member

    Messages:
    2,150
    Likes Received:
    88
    Best Answers:
    0
    Trophy Points:
    145
    #3
    http://httpd.apache.org/docs/2.2/mod/core.html#options

    Within the htaccess for any directory you don't want mod_autoindex working in, turn off Indexes.

    Options -Indexes
    Code (markup):
    To turn it on, you use a plus symbol instead of a hyphen.

    Options +Indexes
    Code (markup):
    Remember that when you don't use a +/- in front of an option, it resets the values of anything that's been set earlier. so if you had FollowSymLinks turned on in your virtual host, and you did the following, something may break.

    Options Indexes
    Code (markup):
    Also note that setting Options in htaccess requires that the Options override allows it.
    http://httpd.apache.org/docs/2.2/mod/directive-dict.html#Override
     
    joebert, Dec 23, 2008 IP
  4. apsam29

    apsam29 Peon

    Messages:
    68
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thankz HSH, it make the thing what I told... :D
     
    apsam29, Dec 23, 2008 IP