How to fix favicon.ico page not found in Drupal

Thanks to Foobarist for the following:

Problem / Symptoms

Your Drupal 5.x or 6.x installation is throwing "Page not found" errors for favicon.ico.  (You can see this in Admin > Logs > Recent Log Entries > Page Not Found)

What's going on?

There is no favicon.ico in the Drupal root directory. 

Drupal's themeing system inserts the following line into your website's source.  This is why when you view your site, you see a favicon in your browser, even though there is no favicon.ico in Drupal's root directory.

<link rel="shortcut icon" href="/misc/favicon.ico" type="image/x-icon" />

But not everyone pays attention to the shortcut link in the page head section.  Some browsers (eg., on bookmarks) or websites (eg., look for http:// directly.  These requests result in a full Drupal bootstrap, only to have Drupal return a 404 and log the page not found.  Wasted resources.

What we want is to avoid Drupal altogether for direct requests for /favico


A. Quickest fix for simple installations

If you're using Drupal for a single site, you can just upload a copy of your favicon.ico to your site's root directory. 

B. Multi-site installations

However, if you have a multi-site installation, dropping the favicon in the root directory will cause it to be used for all your sites.  That's no good.  To get around that, you can use the following rewrite rules to point requests for /favicon.ico to the real location. 

RewriteCond %{HTTP_HOST} \.example\.com$ [NC]
RewriteRule ^favicon.ico$ sites/ [NC,L]

Note that you need to replace "" with your actual domain name(s), and replace the location of favicon.ico if you did not put it in "site/".

This strategy has you place each site's unique favicon.ico into its own sites/ directory.  It works well because it doesn't require a Drupal bootstrap (like the 17490 patch still requires), and allows you (the webmaster) to neatly segregate the different icons without "hacking" core.

Related threads for reference: