Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have implemented Expires headers via mod_expires on my Apache server and have successfully created expires headers for most file types, however I am having trouble with the favicon.

I initially tried adding a set of instructions for the .ico files but when checking via YSlow it has no expiry set.

When this didn't work I amended it to be a GIF, however this seems to have the same issue.

Other gif's on the website have correctly set expires headers (accoridng to YSlow at least).

Can anyone shed any light on this situation?

share|improve this question

migrated from Nov 19 '09 at 7:22

This question came from our site for professional and enthusiast programmers.

If you're using Apache, just add a MIME-Type for the favicon in your website's .htaccess file or to Apache's mime.types file:

# Add Proper MIME-Type for Favicon
AddType image/x-icon .ico

Then, set the Expires header a few month(s) in the future:

# Enable Apache's mod_expires Module
ExpiresActive On
ExpiresByType image/x-icon "access plus 1 month"

After clearing your browser's cache and reloading the page, you should see the favicon.ico file being served with the Cache-Control header being set to a date (specified in seconds) in the future:

Content-Type image/x-icon
Cache-Control: max-age=2592000

For related information, see the YSlow documentation on Making Your favicon.ico Small and Cacheable at:

share|improve this answer
+1 This absolutely works. Make sure to clear your cache though people, I thought this didn't work until I manually cleared my cache. Not sure why a hard refresh didn't do it but whatever. – bought777 Sep 21 '12 at 7:14

This here works for me:

# Cache the following content for 1 month (4 Weeks)
<FilesMatch "\.(jpg|jpeg|png|gif|ico)$">
Header set Cache-Control "max-age=2419200, public"
share|improve this answer

I was using and it was reporting a problem with expires header for favicon.ico, it turned out that I did not have one, I discovered after both solutions above had no effect.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.