Apache and favicon.ico files

Internet Explorer 5 (IE5) has one interesting feature. If you bookmark a page in IE5, it tries to download the image favicon.ico to use in your favourites list instead of the default IE icon.

Apache can be persuaded to give this file out, but there are certain things you have to do to get it to work. It was a pain in the bottom to get it to work, but in the end, we managed it. Bookmark Black Star to see it working.

So what has to be done to make it work? First, at the client end, IE5 has to be the default browser. If it isn't the default browser, it is less inclined to muck about with the favourites list. Of course, as an apache administrator, there is little you can do to tweak the client's end. (I have had reports of IE5 putting the icon in the bookmarks file when it isn't the default browser. Perhaps this is normal?)

Now, at the apache end, you first have to catch your image file and call it `favicon.ico'. It must be 16x16 pixels in size, it must have 16 colours (4-bit) and it must be one of those special .ico files that Windows makes. Not, mind you, a .bmp file renamed to a .ico file, but a real .ico file. Get a real icon editor which can create such files. Alternatively, you could download some extremely neat .ico files from here, or use this site to generate some. (Thanks to Paul A. Franz for mentioning this.)

When we were working this all out, we found that the .ico file kept not being downloaded until we set the execute bit on the image on the server!!! Now, common sense tells you that apache shouldn't give a flying toss whether an image is executable or not, but as soon as we did a "chmod +x" on the file, it started working. Mind you, we probably imagined this. :-)

Finally, you have to put a line in your apache configuration file, httpd.conf, so it feeds .ico files with the right MIME type...

AddType image/x-icon .ico

Once you've done all that, it should work. If you see something wrong in this document, let me know.

Wesley Darlington,
June 1999.
(Last updated 11th December 1999)