2003-12-15, 02:05 PM
Use custom icons with Apache directory listings
If you are running apache, you can replace the default icons used when a directory is listed with your own. The icons are usually in /usr/share/httpd/icons/, /var/www/icons, or in windows it will be under your apache directory under icons and I would suggest backing all of these up before you mess with them. you can do this quickly by typing:
# cp -r /var/www/icons /var/www/icons.bak
You can use the Get Info (Command-I in the Finder) command to view the icon for a certian type of file, then copy it and use Photoshop or something to save the icon as a gif. Then replace the default icon file with the one you have just created. Now when list a dirctory you should see your customized icon.
You can also add new types by edditing you httpd.conf file (/etc/httpd/httpd.conf). Add the line:
AddIcon [PathToIcon] [Extensions]
For example, if you want an icon to show up for disk images then add the line:
AddIcon /icons/diskimg.gif .dmg .cdr .smi
I would suggest adding these lines in with all of the others that are already in the httpd.conf file.
You can also comment out a few lines to protect them using the # sign in front.
Here is what my icon listing looks like.
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/exe.gif .bin .exe .EXE
AddIcon /icons/msi.gif .msi .MSI .Msi
AddIcon /icons/dll.gif .dll .DLL .Dll
AddIcon /icons/ini.gif .ini .INI .Ini .inf .INF .Inf
AddIcon /icons/bat.gif .bat .BAT .Bat
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
AddIcon /icons/a.gif .ps .ai .eps
#AddIcon /icons/layout.gif .shtml
#AddIcon /icons/text.gif .txt
AddIcon /icons/txt.gif .txt .TXT
AddIcon /icons/c.gif .c
AddIcon /icons/p.gif .pl .py
AddIcon /icons/f.gif .for
AddIcon /icons/dvi.gif .dvi
AddIcon /icons/msword.gif .doc .DOC
AddIcon /icons/msexcel.gif .xls .XLS .xlt
AddIcon /icons/dwg.gif .dwg .DWG
AddIcon /icons/ppt.gif .ppt .PPT
AddIcon /icons/zip.gif .zip .ZIP .dat .DAT .cab .CAB .Cab .cat .CAT
AddIcon /icons/msg.gif .msg
AddIcon /icons/msie.gif .html .htm
AddIcon /icons/pdf.gif .pdf
AddIcon /icons/bmp.gif .bmp .gif .jpg .jpeg
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^^
#
# DefaultIcon is which icon to show for files which do not have an icon
# explicitly set.
#
DefaultIcon /icons/unknown.gif
See how I commented some and also added all types of extensions so that apache will not get ticky about it.
Here are what a few look like that I created and use.
[/url][url=http://www.thebatchfile.com/junk/list/]http://www.thebatchfile.com/junk/list/