Problem/Motivation

This is a followup to #174940: Root /favicon.ico accounts for majority of 'Page not found' errors. After that was committed work continued there and it was difficult to determine what needed to be fixed. Thus this new issue. It is worth reading the comments after that was first marked fixed, which being at #69.

The solution in that issue was to add favicon to the .htaccess rewrite rules like this:

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

This 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.

Steps to reproduce

Proposed resolution

Remaining tasks

Reminder to add credit from the #174940: Root /favicon.ico accounts for majority of 'Page not found' errors

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
#2 favicon404-174940-92.patch906 bytesquietone

Comments

quietone created an issue. See original summary.

quietone’s picture

Issue summary: View changes
StatusFileSize
new906 bytes

This is the latest patch from the other issue.

Still need to add credit and move relevant comments over to here.

quietone’s picture

Issue summary: View changes
a.ross’s picture

I don't think that patch does anything. Apache produces the 404 itself.

My suggestion was to just add a dummy favicon.ico to the webroot: https://gist.github.com/ameenross/2cc35daa45b5b3e2fe840ddcce95523b

It could be done by a script or something to allow for people to remove or replace it if they feel like it. That way it won't be overwritten by a Drupal update.

FWIW, I've done something similar in the past for recurring 404's on URLs like apple-touch-icon.png. Solution, the following console command: $ touch apple-touch-icon.png. Never had any complaints.

jwilson3’s picture

Here is the way to suppress 404 errors from apache error logs, but have them still show up in access logs:

# Don't log missing favicon.ico to Apache error log
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^/favicon.ico - [R=404,L]

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.