Remove apache’s DirectoryIndex

apache-2.2

Is it possible to turn apache's DirectoryIndex off for specific directory using .htaccess file? I've tried DirectoryIndex Off but if file Off exists it uses it as index file. I want to make sure that the directory will be listed no matter what files are inside.

Best Answer

You have a couple of options:

  1. Set DirectoryIndex to a filename that will never possibly exist.

    DirectoryIndex lni345hoqvgheruhgreoiuhgeroi30948yt0348
    
  2. Don't load the mod_dir module. This, however, will disable the index.html style functionality for the entire server, and is probably not what you want.

Beginning with Apache 2.4 you can set DirectoryIndex disabled to disable its functionality.