Skip to content

Cache Your Favicon to Speed Up Your Site

Learn how to cache the favicon on your web 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>

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

Topic: Search Engine Optimisation
Tagged as: Apache, cache, favicon, htaccess file, search bots, server load

Share on FriendFeed

{ 0 comments… be the first to comment }

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Any comments that look like spam will be treated as spam - this includes SEO titles and use of spurious keywords.

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