开发者

how does this favicon.ico helps server bandwidth?

i was reading programmers.stackexchange.com/questions/46716...... Question Answer in that there's a point sayi开发者_运维技巧n

If you don’t have a /favicon.ico, this will result in a lot of 404s, draining your server’s bandwidth.

i just dont know how this icon helps in saving server's bandwidth ? i know 404 is a Not Found Error message but what this /favicon.ico plays role here ?

please somebody explain me this...


I see a couple of possibilities. The first is that your favicon.ico file may be smaller than the 404 page, but that's probably not much of a difference.

However, if you have a massively complex custom 404 page that dynamically goes out to your database to get some information, there will be a hell of a difference in load compared to a static resource like the favicon.

The second is the possibility that a real favicon may be cached somewhere along the way, either in the browser displaying your page, or somewhere else not on your site.

This means that subsequent requests for it won't touch your server at all.

It's unlikely that a 404 received by the browser will be cached in the same way, so the browsers would be far more likely to try again next time, leading to more load on your servers.


In your comment, you question what the favicon is for so I'll cover that just in case: it's requested by browsers so that they can use it to (for example) provide an icon in the address bar, or on a bookmark, for your link.

That way, Google (for example) could have a favicon consisting of the stylised 'G', Wikipedia has their 'W', and so on. Even StackOverflow has their nifty little overflowing in-tray sitting to the left of my address bar right now.

See the Wikipedia favicon entry for more information than I want to cut-and-paste into this tiny text entry box :-)


I'm guessing it's because the 404 page has a larger size than the favicon.ico. At least most of the time it is...


If you do not have or want /favicon.ico on your site here's how to stop filling up your access_log and error_log with 404 hits. Add to this your apache conf or .htaccess:

## Send 204 "No Content" for /favicon.ico in the web root
Redirect 204 /favicon.ico
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜