Apache Icons

I've often searched for a replacement for the standard icons that come with Apache. The default icons date back to Mosaic for X and have been included in the NCSA httpd and Apache server distributions. These continue to be distributed with even the latest versions of Apache. I haven't found any publicly available replacements for these icons, so I decided to build my own.

I didn't reinvent the world here, I just modernized the standard set. The task of creating a whole new representational logic was too great a task for my purposes. Furthermore, the prevalence of these icons makes them easily understood.

All icons maintain the original size so they can be used as a drop in replacement.

The Icons


a.gif alert.black.gif alert.red.gif back.gif ball.gray.gif

ball.red.gif binary.gif binhex.gif blank.gif bomb.gif

box1.gif box2.gif broken.gif burst.gif c.gif

comp.blue.gif comp.gray.gif compressed.gif continued.gif dir.gif

diskimg.gif down.gif dvi.gif f.gif folder.gif

folder.open.gif folder.sec.gif forward.gif generic.gif generic.red.gif

generic.sec.gif hand.right.gif hand.up.gif image1.gif image2.gif

image3.gif index.gif layout.gif left.gif link.gif

movie.gif p.gif patch.gif pdf.gif pie0.gif

pie1.gif pie2.gif pie3.gif pie4.gif pie5.gif

pie6.gif pie7.gif pie8.gif portal.gif ps.gif

quill.gif right.gif screw1.gif screw2.gif script.gif

sound1.gif sound2.gif sphere1.gif sphere2.gif tar.gif

tex.gif text.gif transfer.gif unknown.gif up.gif

uu.gif uuencoded.gif world1.gif world2.gif  

Installation & Configuration

The icon set is meant to be a drop in for a standard Apache install. If you have full access to the server, you can just replace the current icons with the icons in this set. On OS X, the standard installation location is /usr/share/httpd/icons. This directory is referenced by a global directive in the httpd.conf file. This includes an alias for /icons/ that is resolved for every domain being served.

On OS X and Darwin, this directory is owned by the system (root) with the group ownership belonging to "wheel". It is best to follow the same permission model when replacing these files.

Check the permissions of the directory and its contents.

cd /usr/share/httpd
ls -la
This should return something similar to:
total 0
drwxr-xr-x    3 root  wheel   102 23 Sep  2003 .
drwxr-xr-x   44 root  wheel  1496 27 Sep  2003 ..
drwxr-xr-x  156 root  wheel  5304  9 Oct 16:51 icons
Look inside of the icons folder and check the permissions their. If the ownership and/or permissions are incorrect, then the following should rectify the issue:
sudo chown -R root:wheel ./icons
sudo chmod -R 644 ./icons
sudo chmod 755 ./icons
sudo chmod 755 ./icons/small
The first step recursively changes the owner and group for all items in ./icons. The following command, sudo chmod -R 644 ./icons changes the permissions to read/write for the owner, and read only for all others. The -R flag indicates to perform recursively. This is the quick way to modify all of the documents. The following commands correct the permissions on the directories, by enabling the execution bit which is required for users to access these directories.

Other Peoples Servers

If you are using someone else's computer, or your site is hosted by a webhosting company, it is likely that you won't have access to make this kind of modification to the server. Here is where the .htaccess file comes in handy.

The .htaccess file is just a list of directives that are observed by Apache. It essentially extends the httpd.conf file on a localized level. By default, the standard Apache install includes an Alias directive for /icons which cannot be overridden by the .htaccess file. However, the directives pertaining to directory listings can be localized.

The configuration that I am using on this site is available for download. This configuration is derived from the default <IfModule mod_autoindex.c> block. The primary modification made was to set the icon paths to the new icons. In my configuration, I store the new icons at the top level of my site in a directory named /icon. I then searched and replaced /icons with /icon. A shortened exerpt is below:

<IfModule mod_autoindex.c>
    AddIconByEncoding (CMP,icon/compressed.gif) x-compress x-gzip

    AddIconByType (TXT,icon/text.gif) text/*
	...
    AddIconByType (VID,icon/movie.gif) video/*

    AddIcon icon/binary.gif .bin .exe
	...
    AddIcon icon/blank.gif ^^BLANKICON^^

    DefaultIcon icon/unknown.gif
</IfModule>

Also located in the icons directory is a header file. This header is used by the server when generating a directory listing. It is a standard html document with the exception of the closing </body> and </html> tags. This document can be modified to emulate the look and feel of ther rest of your site. For my site, I have included a logo and a search form.

And for our last stupid .htaccess tricks, you can use this to modify the error documents that your site uses. This modification is made outside of the IfModule block, with the following directives:

#	"400 Bad Request",
ErrorDocument	400		/errordocs/400.php
#	"401 Authorization Required",
ErrorDocument	401		/errordocs/401.php
#	"403 Forbidden",
ErrorDocument	403		/errordocs/403.php
#	"404 Not Found",
ErrorDocument	404		/errordocs/404.php
#	"408 Request Timeout"
ErrorDocument	408		/errordocs/408.php
#	"500 Internal Server Error",
ErrorDocument	500		/errordocs/500.php

These directives tell Apache which document to serve when they occur. For my site, I have set up the 404.php page to have a search form, so if a user attempts to connect to a page that no longer exists, they are in a position to immediatly search for what they were looking for. Other uses my be to setup random redirets to anyone getting a "Forbidden" error. Unlike the header document in the directory listing, the error documents are standalone pages.

Downloads

Apache icons:
http://www.ideocentric.com/files/download/http-icons.tgz
.htaccess configuration:
http://www.ideocentric.com/files/download/htaccess.txt

They are being placed in public domain, however, I am requesting that proper credit to myself and the original icon creators is given and that the provided read me file is distributed with the icons.