Webhosting Directory Index: Difference between revisions
mNo edit summary |
(→Other Webhosting pages: clean up) |
||
Line 20: | Line 20: | ||
or download: [[File:directory_index.zip]] |
or download: [[File:directory_index.zip]] |
||
==Other Webhosting pages |
==Other Webhosting pages== |
||
<ncl style=bullet maxdepth=5 headings=bullet headstart=2 showcats=1 showarts=1>Category:Webhosting</ncl> |
<ncl style=bullet maxdepth=5 headings=bullet headstart=2 showcats=1 showarts=1>Category:Webhosting</ncl> |
||
Revision as of 00:25, 18 August 2018
The web server does not automatically produce a directory index, i.e. a list of files in a directory if there is no index page. However, it is simple to add a directory index to a directory using a simple script. If you load the following as index.html then it will produce a simple directory index for the directory it is in. Obviously a much more sophisticated script could be written with icons, and sub directories, and so on, and there may be such scripts available on the web in perl.
#!/bin/csh
echo "Content-Type: text/html"
echo ""
echo "<HTML>"
echo "<TITLE>$REQUEST_URI/</TITLE>"
echo "<BODY BGCOLOR=#FFFFFF>"
echo "<H1>Directory listing of $REQUEST_URI/</H1>"
echo "<PRE>"
foreach f (*)
echo -n "<A HREF='$f'>*</A> "
/bin/ls -l "$f"
end
or download: File:Directory index.zip
Other Webhosting pages
<ncl style=bullet maxdepth=5 headings=bullet headstart=2 showcats=1 showarts=1>Category:Webhosting</ncl>