We use an apache 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?
We use an apache 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?
This can't be done with pure HTML.
However if you have access to PHP on the Apache server (you tagged the post "apache") it can be done easilly - se the PHP glob function. If not - you might try Server Side Include - it's an Apache thing, and I don't know much about it.
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
or add the autoindex mod: http://httpd.apache.org/docs/current/mod/mod_autoindex.html
Did you try to allow it for this directory via .htaccess?
Options +Indexes
I use this for some of my directories where directory listing is disabled by my provider
For me PHP is the easiest way to do it:
<?php
echo "Here are our files";
$path = ".";
$dh = opendir($path);
$i=1;
while (($file = readdir($dh)) !== false) { if($file != "." && $file != ".." && $file != "index.php" && $file != ".htaccess" && $file != "error_log" && $file != "cgi-bin") {
echo "<a href='$path/$file'>$file</a><br /><br />";
$i++;
}
}
closedir($dh);
?>
Place this in your directory and set where you want it to search on the $path. The first if statement will hide your php file and .htaccess and the error log. It will then display the output with a link. This is very simple code and easy to edit.