Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Dec 2006
    Posts
    185
    Thanks
    17
    Thanked 0 Times in 0 Posts

    Eliminate Directory Listings with Apache

    HI

    Does anyone know how to prevent users from seeing a file list of a directory that doesnt have a index file in it? Im using apache 2.

    Thanks

  • #2
    ess
    ess is offline
    Regular Coder
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    866
    Thanks
    7
    Thanked 30 Times in 29 Posts
    create a .htaccess file and place it in the root directory of your website...so that all sub-directories would inherit this functionality.

    add the following line (inside .htaccess file) to prevent directory listings of all files and dirs.

    Code:
    IndexIgnore *
    Or, you can turn directory listing off all together by adding this line
    Code:
    Options -Indexes
    cheers,
    ~E

  • Users who have thanked ess for this post:

    thekevin07 (09-23-2007)

  • #3
    Regular Coder
    Join Date
    Dec 2006
    Posts
    185
    Thanks
    17
    Thanked 0 Times in 0 Posts
    thank you

  • #4
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    Also if you actually have control over the server and wish for directory listings to be disabled all the time, you can use the Options directive where you declared the site in your apache configuration file.
    OracleGuy


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •