: Apache create index for directories without one specified. 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
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?
More posts by @Pierce454
1 Comments
Sorted by latest first Latest Oldest Best
What you're looking for, is mod_autoindex
httpd.apache.org/docs/2.2/mod/mod_autoindex.html
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
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.