Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use custom icons with Apache directory listings Internet
If you are running apache, you can replace the default icons used when a directory is listed with your own. This way you can make your webserver running on OSX look like it is running on OSX. The icons are in /usr/share/httpd/icons/, and I would suggest backing all of these up before you mess with them. you can do this quickly by typing:
sudo cp -r /usr/share/httpd/icons /usr/share/httpd/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.
  • Currently 4.00 / 5
  You rated: 4 / 5 (2 votes cast)

Use custom icons with Apache directory listings | 14 comments | Create New Account
Click here to return to the 'Use custom icons with Apache directory listings' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
come-on workaholic icon designers
Authored by: Diggory on Nov 07, '02 10:41:55AM

Now all we (non-graphically talented) users need is for someone to ddring out an aqua icon set for apache - there's only(!) 154 icons to do...

[ Reply to This | # ]
It's not as much work as it seems.(come-on workaholic icon designers)
Authored by: jago_lebow on Nov 07, '02 12:13:39PM

Actually appache only uses a few of those icons.Out of all of them it only uses 25. Don't worry about the .png's. It doesn't take any skills at all to create your own icons, I did it in about an hour. I would be willing to post my icons and my httpd.conf file ( i added a few extra types ). If some one tells me where to post.

The real fun is when you define your own types. here are some of the types that I added.

AddIcon /icons/sit.gif .sit
AddIcon /icons/pkg.gif .pkg
AddIcon /icons/diskimg.gif .dmg .cdr .smi .toast
AddIcon /icons/webloc.gif .webloc
AddIcon /icons/cwk.gif .cwk

Once I get a break from school I will try to make a package that will install the icons. Keep an eye on version tracker.

Now the only thing I'm worried about is getting sued by apple ( or aladin , I stole some stuf from them too ). If any one can give me some advice on this I would apricieate it.

[ Reply to This | # ]
Script it to all happen locally
Authored by: maggard on Nov 07, '02 02:25:20PM
So don't distribute the questioniable icons - just a script to create them from resources already on the users machine.

Pull the selected icons from their sources with the script, pump them through a tool to create the GIFs or JPEGs or PNGs or whatever, and then save them in the right places along with the updated Apache settings.

That way not only are you not distributing any questioniable-IP graphics and you're also future-proofing the tool for when Apple or Alladin or whomever else you're using for sources updates their icons. Indeed with folks theming their desktops a script working this way should be abble to grab whatever those folks are using for their settings and automagically apply these as the Apache icons.

[ Reply to This | # ]

Script it to all happen locally
Authored by: dr_turgeon on Nov 07, '02 03:15:21PM
I like this idea, maybe someone will create this script...
But getting sued for compiling a little mac/apache icon set -- Come On!

[ Reply to This | # ]
Script it to all happen locally
Authored by: maggard on Nov 07, '02 05:04:42PM
But getting sued for compiling a little mac/apache icon set -- Come On!

Let me introduce you with a little something we all call… Reality.

  1. Guidelines for Using Apple Trademarks and Copyrights
  2. I'm Furious at Apple
  3. Apple padlocks UI decor
  4. Apple wants to squish themes project
  5. Whither themes in an open source world?

Next time before you make a what is apparently intended as declarative statement, particularly a derogatory or dismissive one, you would do well to familiarize yourself at least minimally with the topic…

[ Reply to This | # ]

Script it to all happen locally
Authored by: dr_turgeon on Nov 08, '02 02:57:08AM
Chill, no offense intended. Please make your script! I'm just saying I'm not at all inclined to fear a legal desist letter when customizing my system, or making these tweaks freely available.
I'm aware of these links you compiled. Notice that in no way have people stopped customizing their systems. Look at, please and enjoy :) [watch for an apache icon set there soon]

[ Reply to This | # ]
Script it to all happen locally
Authored by: maggard on Nov 08, '02 10:28:01AM
While no offense may have been intended it was still offensive. Also wrong. And still wrong.

Apple can and does go after folks who infringe on their trade dress. Coming up with your own theme isn't the issue, using theirs is. They are quite aggressive about this, indeed from a legal and fiduciary responsibility standpoint they pretty much need to be.

While your intention may be to distribute the icons for use on Macs running Apache Apple's law form may just see it as distributing Apple's graphics. The next day the file's host will get a lovely form letter indicating the material in question, a request to remove immediately, and a threat of expensive legal action and fines if they don't comply, immediately.

This isn't far-out or paranoid; it has happened and continues to happen regularly. Those references I posted are all quite explicit about what has happened when other folks, equally well meaning, often just as trivial, have attempted to use Apple's materials in new and creative ways. Apple has no problem with original stuff, just with their stuff.

I'm not an oracle, I don't work for Apple or their law firm, but the law, and Apple's application of it, are pretty clear. Frankly I think a script to create the files locally is safest and most robust way to go (heck just script exactly what you're doing manually) but you and whomever hosts your material are welcome to test out posting the icons. I however do strongly suggest that whatever you don't post the Apple logo in any of that as it is clearly the most sensitive piece.

[ Reply to This | # ]

Help me get started with making a script
Authored by: jago_lebow on Nov 07, '02 10:11:08PM

This seems like a great idea. If you can point me a lil more in the right direction I would be happy to make this script/app

Thanks for comming to my defense. I do feel a little silly worrying about getting sued but I figure better worry now then have to pay later.

Here is a little bit of a warning though. I am a poor college student so If I do make an app to help customize apache, It will probably be semi shareware. I feel like an ass dooing this but I\'m also broke and time I spend working on this is time that I\'m not studying. I wouldn\'t want to make ppl pay who are like me so more than likely it will be a pay what you think its worth kinda deal.

Any way I would apreciate any help that could be given.

[ Reply to This | # ]
A few tips
Authored by: androse on Nov 08, '02 09:35:09AM

I played around with this a couple of weeks ago, here is what I found out :

The directory listing capabilities of Apache is handled by the mod_autoindex module. You can change more than the icons, you can for exemple :

  • change the 'header' of the HTML output with the
  • reorder the elements with a 'natural order' algorithm (for exemple: "a, B, c, D" and not "B, D, a, c") with the
  • list all folders first with the
  • set the width in characters for description and name columns with the
    DescriptionWidth=XX, NameWidth=XX
  • etc...

You can see an example of what I got at the end.

There are my httpd.conf options :

IndexOptions FancyIndexing
IndexOptions ScanHTMLTitles
IndexOptions SuppressHTMLPreamble
IndexOptions IconsAreLinks
IndexOptions NameWidth=*
IndexOptions DescriptionWidth=25
IndexOptions IgnoreCase

AddIconByType (TXT,/icons/IDS_texte.gif) text/*
AddIconByType (IMG,/icons/IDS_image.gif) image/*
AddIconByType (SND,/icons/IDS_audio.gif) audio/*
AddIconByType (VID,/icons/IDS_video.gif) video/*
AddIcon /icons/IDS_parent.gif ..
AddIcon /icons/hand.right.gif README
AddIcon /icons/IDS_directory.gif ^^DIRECTORY^^
AddIcon /icons/IDS_blank.gif ^^BLANKICON^^
DefaultIcon /icons/IDS_default.gif

HeaderName /icons/headerAutoIndex

In a nutshell, you cannot change the HTML output of the file listing itself (with a template for example), but you can change the header and footer, so you can add a CSS, Javascript (who would need that ?), etc. Redesigning the icons is a must :)
Good luck.

Reply to This | # ]
Gee, I should have posted this a year ago...
Authored by: BrunoUsesBBEdit on Nov 08, '02 11:23:48AM
I did this a year ago and thought about posting it, but never did. I am a converted PC programmer, now Mac based Web Applications Developer. So now I am fully infatuated with Mac style, so I do this to all my web servers. Visit my Junk Drawer for an example. The file "Mac indexing for Apache.sit" has the how-to that I made for a coworker. I hope it makes since. I didn't add too much detail, since his is quite the Open Source wiz kid. (there's yer props Joe!)

[ Reply to This | # ]
Gee, I should have posted this a year ago...
Authored by: jago_lebow on Nov 09, '02 03:23:34AM

Wow. Yours is great, You put me to shame.

Any one else looking at this. This guys stuff is much better than mine.

[ Reply to This | # ]
Gee, I should have posted this a year ago...
Authored by: shacker on Feb 15, '03 04:13:33AM

Note, unless you set

AllowOverride None


AllowOverride All

in your main httpd.conf and restart httpd, your local .htaccess file will not be respected!

[ Reply to This | # ]
Gee, I should have posted this a year ago...
Authored by: something2sea on Jul 13, '06 03:34:23PM

Bruno, how did you get the names of your files and the other text captions "centered" vertically up the side of the icon, instead of at the bottom of the icon like it is by default?

thanks in advance

[ Reply to This | # ]
Doesn't work for me
Authored by: waffffffle on Mar 06, '03 07:19:12AM

This used to work for me, but not anymore. Does anyone know why? Now when I tried to install this stuff I get this:

Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, ---- and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

[ Reply to This | # ]