Most browsers are looking for that little favicon to display a 16×16 icon next to the URL in the address bar. How does this work? There are two main ways:
- They check if a file is available at /favicon.ico
- They check if a proper link tag has been set:
<link rel="shortcut icon"
href="http://www.oraclerecipes.com/oraclerecipesicon.ico" />
But what happens if you don’t do anything of the above? The browser will still try to search for favicon.ico. While you don’t even see that when you open your browsers console, the webserver will notice that. If you check your webservers log file, you’ll find something like this:
www.oraclerecipes.com 88.222.33.111 - - [04/Sep/2011:08:09:23 +0200] "GET /favicon.ico HTTP/1.1" 404 751 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1"
The concrete5 URL rewriting rules check if the requested path is a static file but since it doesn’t exist, the request is forwarded to the dispatcher. This means that concrete5 will search through its database to see if there’s a concrete5 page available at /favicon.ico but obviously won’t return anything else but “Page not found”. This database lookup can easily consume 100ms which isn’t a lot but assuming you’ve got a busy site, this is probably still something you’d like to get rid!
3 Comments
Das hatte ich schon länger im Kopf… eher im Sinne für’s Branding, doch dass sich dies auf die Leistung auswirkt; Des ist mir neu! 🙂
Danke für den Tipp und weiterhin toi, toi, toi!
Cheers!
Is this still true for the current c5 versions (5.6 and 5.7)?
This is probably true for every CMS where you can’t have a favicon. The browser will look for one and if your CMS has to render a 404 page it takes a tiny bit of unnecessary time.