Click to See Complete Forum and Search --> : Custom Directory Listing
beley
03-17-2003, 04:54 PM
I would like to setup a custom directory listing in Apache for one directory (or even the entire virtual host) on my server... does anyone know how to customize the listing with additional text and information? Or change / add icons and associate them with file extensions? (like .doc)
Seminole
03-18-2003, 03:13 AM
If you have PHP installed, one of these may be what you want. You would probably need ot hack one of these with custom images and file associations.
1 http://fpt.sourceforge.net/
Sitemap
2 http://www.metalhead.ws/phpbin/
Demo here
http://www.metalhead.ws/phpbin/sitemap.php
Another Example
3 http://www.hotscripts.com/Detailed/16281.html
beley
03-18-2003, 09:12 AM
Thanks for the suggestion... I would rather change the actual settings in Apache, if possible. I guess I can make an "index.php" page but would rather just have Apache list the directory contents...
Seminole
03-18-2003, 12:26 PM
Oh OK, well I found the part of httpd.conf for that...
#
# AddIcon* directives tell the server which icon to show for different
# files or filename extensions. These are only displayed for
# FancyIndexed directories.
#
AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
AddIconByType (TXT,/icons/text.gif) text/*
AddIconByType (IMG,/icons/image2.gif) image/*
AddIconByType (SND,/icons/sound2.gif) audio/*
AddIconByType (VID,/icons/movie.gif) video/*
AddIcon /icons/binary.gif .bin .exe
AddIcon /icons/binhex.gif .hqx
AddIcon /icons/tar.gif .tar
AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
AddIcon /icons/a.gif .ps .ai .eps
AddIcon /icons/layout.gif .html .shtml .htm .pdf
AddIcon /icons/text.gif .txt
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/uuencoded.gif .uu
AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
AddIcon /icons/tex.gif .tex
AddIcon /icons/bomb.gif core
AddIcon /icons/back.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^
Then you could place your custom images in the icons folder
/var/www/icons
Then change the image name for the mime type that you want. Eg,
AddIcon /icons/doc.gif .doc
I'm sure that's all you would need....
Try it and see (make sure that you have a "doc" image in the icons folder before adding the line to httpd.conf..
I actually think your method is easier and I'll probably change it myself later down the road...
Thanks for the idea....
JThundley
01-21-2004, 08:33 AM
wow, thread resurrection...
I am having such a hard time getting directory listings to show up at all. How did you do it? I have php installed, but I'm not using it. I found out that mod_autoindex is what produces the directory listings, but I can't get them to show up anyway.
I'm using apache-2.0.48-r1 on Gentoo.