Preventing directory listing in Apache

To prevent directory listing in Apache, add the following line to .htaccess in the top level of the directory you want to do it.

Options -Indexes

To allow directory listing for specific subdirectories, you can add the following in the .htaccess of the subdirectory to override the parent directory’s default setting.

Options +Indexes

To get this working, you would need override support in the Apache configuration.

  • Digg
  • del.icio.us
  • Twitter
  • Facebook
  • Google Bookmarks
  • LinkedIn
  • Live
  • Yahoo! Bookmarks
  • Posterous
  • Sphinn
  • Mixx

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">