Page tree
Skip to end of metadata
Go to start of metadata

The Problem

Not having a favicon will clog up your log files with lines like these, - - [27/Sep/2009:22:00:17 -0400] "GET /favicon.ico HTTP/1.1" 404 240 "-" "Mozilla/5.0... - - [27/Sep/2009:22:00:20 -0400] "GET /favicon.ico HTTP/1.1" 404 240 "-" "Mozilla/5.0... - - [28/Sep/2009:00:17:19 -0400] "GET /favicon.ico HTTP/1.1" 404 240 "-" "Mozilla/5.0...

If you do not know what is a favicon is, well here is a direct link to the Wikipedia on favicon.

Configure a 0 Byte favicon.ico

In some cases your website does not require a logo and you just want the errors to stop showing up.

If you want to create you own custom logo consider using Dynamic Drive's favicon.ico generator or reading articles like Pixel Art's Create a Better Favicon For Your Website.

0 Byte favicon.ico

In this case you can download my 0 byte favicon.ico and place it in the /var/www folder or you can create your own using the touch command,

sudo cp ~/favicon.ico /var/www/

At this point you should stop seeing the 404 error entries in both your main host and your virtual host, but the favicon logo (if you chose to use one) will not show up on browsers yet. The next section explains how to do so.

Enable ico Files in Page

favicon is specified at the web page level.

To activate your favicon, you must modify the source of your web page. Add this line to the <head> section of your page:

<link rel="shortcut icon" href="/favicon.ico">

For example,

    <title>This is the title of my page!</title>
    <link rel="shortcut icon" href="/favicon.ico">
    Hello world!
  • No labels