Currently, I use a PHP script to list the contents of a directory that does not have an index file, but I don't want to have to copy it to every directory without an index.
Can Apache do it automatically?
Webmasters Stack Exchange is a question and answer site for pro webmasters. It only takes a minute to sign up.Sign up to join this community
What you're looking for, is
Make sure you have it enabled in the Apache configuration:
LoadModule autoindex_module /usr/lib/apache2/modules/mod_autoindex.so
Note: you may have to change the path directory to the module, or even change the module name. On SOME Apache servers I've seen, it may be just:
LoadModule mod_autoindex /path/to/mod.so
In response to the comments: (edit)
#put this in a `.htaccess` in your root directory #this sends 403 errors to any directory w/o index. Options -Indexes ErrorDocument 403 /path/to/file.php