Directory Listing Icons


#1

Is it possible to add small filetype icons so they are displayed when a user views the directory listing from their browser?

I have several different filetypes hosted and little icons would make finding the relevant files a little bit easier.


#2

First, in the panel, go to Remap Sub-Dir and map /icons to /usr/share/apache/icons. Then add the following to .htaccess in the root directory of the domain you want this to affect (or the directory in question, if you only care about one directory):

[code]# 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/deb.gif .deb
AddIcon /icons/back.gif …
AddIcon /icons/hand.right.gif README
AddIcon /icons/folder.gif ^^DIRECTORY^^
AddIcon /icons/blank.gif ^^BLANKICON^^

DefaultIcon: which icon to show for files which do not have an icon

explicitly set.

DefaultIcon /icons/unknown.gif
[/code]

If you want useful replies, ask smart questions.


#3

Thank you for the help. I am new to this, so I apologize in advance if the solution is obvious.

I think I mapped everything properly, maybe not. When I go in using my FTP program Filezilla, I notice that brand new folders have been created - usr/share/apache/icons, but of course no files are inside. Where am I supposed to get the icon files from?


#4

Hmm, it appears you can’t create a mapping to a directory outside your home directory. I haven’t actually done it so I didn’t realize. Ok, skip that and delete the mapping you created. Let’s try an alternate approach, one I actually prefer, myself.

Log in to your account via SSH and run these commands:

cd www.example.org ln -s /usr/share/apache/icons/ icons (where “www.example.org” is the directory of the site in question).

This is (more-or-less) how I do it on one of my sites. It eliminates the need to remap a directory.


If you want useful replies, ask smart questions.


#5

Thank you for the help, your SSH suggestion worked perfectly.

By the way, when I browse the directories starting at the domain name itself (I have no index or html files yet, just files), is it normal to be able to browse the new icons folder just like any other folder?


#6

Yes, this is normal. It’s as if this is a normal directory just like your regular ones (except that you can’t modify the contents).


If you want useful replies, ask smart questions.