Mobile app version of vmapp.org
Login or Join
Pierce454

: 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

@Pierce454

Posted in: #Apache #Php

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Pierce454

1 Comments

Sorted by latest first Latest Oldest Best

 

@Phylliss660

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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme