Search code examples
htmlwebserver

How can I create a simple index.html file which lists all files/directories?


We use a web server that does not allow directory listing.

There is a specific directory I would like to allow listing of.

How can make a simple HTML file that will contain the contents of this directory?


Solution

  • You can either: Write a server-side script page like PHP, JSP, ASP.net etc to generate this HTML dynamically

    or

    Setup the web-server that you are using (e.g. Apache) to do exactly that automatically for directories that doesn't contain welcome-page (e.g. index.html)

    Specifically in apache read more here: Edit the httpd.conf: http://justlinux.com/forum/showthread.php?s=&postid=502789#post502789 (updated link: https://forums.justlinux.com/showthread.php?94230-Make-apache-list-directory-contents&highlight=502789)

    or add the autoindex mod: http://httpd.apache.org/docs/current/mod/mod_autoindex.html