Skip to content

Performance icon

Cache Your Favicon to Speed Up Your Site

Learn how to cache the favicon on your Mambo site to reduce the number of HTTP requests, speed up your site, and lessen your server load. Every time someone loads a page from your Mambo site the favicon is requested. When search bots visit your site they can generate a lot of traffic with calls to the favicon. Here's how to do something about this:

  • Check that your server is running Apache.
  • Check that your server is running mod_headers (most are)
  • Check that you can use an .htaccess file (if you are using the inbuilt Mambo SEF then you are already using .htaccess)

If all these are in place, then add this directive to your .htaccess file.

<FilesMatch "\.ico$">
Header set Expires "expiryDate"
</FilesMatch>

You can set the expiryDate to any date in the future that you want. So, for example, if you plan to have your site online for several years and don't think you will change your favicon for a long time, then this may be appropriate: "Mon, 20 Apr 2015 23:30:00 GMT".

Here's the completed directive:

<FilesMatch "\.ico$">
Header set Expires "Mon, 20 Apr 2015 23:30:00 GMT"
</FilesMatch>

Bookmark This:
  • bodytext
  • Technorati
  • del.icio.us
  • Facebook
  • Google
  • StumbleUpon
  • Reddit

Whether I am developing Mambo or working on tutorials I am fuelled by coffee. Caffeine keeps me going so if you like the work I am doing please click on the cup to buy me a coffee today. Just $10 covers the cost of getting my caramel macchiato ;)

If you enjoyed this article make sure you subscribe to my RSS feed!

Leave a Reply

This is a gravatar-friendly site, enter your email address to use your gravatar.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.