Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
using this modul I got 404 error on calls to mysite.com/favicon.ico
I found that the used theme_get_setting('favicon_path') returns public://favicon.ico which results in an empty realpath($favicon).
In _favicon_get_favicon_file() I have changed
$favicon = theme_get_setting('favicon_path');
to
$favicon = theme_get_setting('favicon_path');
$files_dir = variable_get('file_public_path', conf_path() . '/files');
$favicon = str_replace('public:/',$files_dir,$favicon);
in order to get the favicon correctly.
Comment | File | Size | Author |
---|---|---|---|
#7 | favicon-404-not-found-fix-2217827-7-D7.patch | 1.03 KB | oushen |
#5 | favicon-404-not-found-fix-2217827-5-D7.patch | 1.03 KB | oushen |
#2 | realrealpath.txt | 382 bytes | kingandy |
Comments
Comment #1
johnennew CreditAttribution: johnennew commentedWording on the Drupal core settings page for the shortcut icon is terrible.
I think it means you to enter a file path which is relative to the site root, not the public files directory.
Comment #2
kingandy CreditAttribution: kingandy commentedMaybe this is one of the rare cases when drupal_realpath() is appropriate?
I've tested on my local system (which was likewise using a 'public://' URI), and it seems to work fine. It also works with the default 'misc/favicon.ico' path, so I guess it would work with theme-default paths, but I haven't tested that.
Find attached a patch, though it's really a very simple change...
Comment #3
kingandy CreditAttribution: kingandy commentedComment #4
cmseasy CreditAttribution: cmseasy commented#2 worked for me in a multisite drupal environment. Thanks!
Comment #5
oushen CreditAttribution: oushen commentedPatch for fix 404 error
Comment #7
oushen CreditAttribution: oushen commentedFixed patch file after test failed
Comment #8
oushen CreditAttribution: oushen commentedComment #10
oushen CreditAttribution: oushen commentedComment #11
Dave ReidThis should be resolved with the most recent release, 7.x-2.0. It is safe for everyone to upgrade to since there's no data that actually needs upgrading.