Root /favicon.ico accounts for majority of 'Page not found' errors

Created on 12 September 2007, almost 17 years ago
Updated 23 October 2023, 9 months ago

Problem/Motivation

.htaccess contains

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteRule ^ index.php [L]

which effectively means that Apache won't run PHP and therefore no Drupal bootstrap happens. Apache handles the request itself. However, what that means is that Apache's own error log will be filled with entries about a missing 'favicon.ico' file. This is what gagarine mentioned in #174940-69: Useless favicon.ico 404 messages in logs β†’ and this has never been fixed.

Credit to a.ross in #121 πŸ› Root /favicon.ico accounts for majority of 'Page not found' errors Fixed

Steps to reproduce

Proposed resolution

  • Add a menu item for favicon.ico to return the theme's shortcut icon.
  • Add a note in .htaccess about how to skip the Drupal bootstrap when the favicon.ico requests are made, while still returning the correct shortcut icon.

Remaining tasks


Review

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Fixed

Version

8.9 ⚰️

Component
BaseΒ  β†’

Last updated 29 minutes ago

Created by

πŸ‡ΊπŸ‡ΈUnited States sparr

Live updates comments and jobs are added and updated live.
  • html5

    Implements and supports the use of HTML5.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡°Denmark ressa Copenhagen

    My Drupal 7 logs were getting filled with "page not found" entries looking for a root favicon file at https://example.org/favicon.ico. I thought this issue was fixed by default in Drupal 7, but I had to enable drupal_fast_404(); in settings.php and now these requests are not getting logged, great.

Production build 0.69.0 2024