: Do I still need a favicon in the webroot when an alternate location has already been provided? While looking through the access log of my webserver, I notice a few favicon requests that shows
While looking through the access log of my webserver, I notice a few favicon requests that shows 404 error:
16:17:28 GET /folder/abc.jpg 200 example.com/ Mozilla... Firefox/31.0
16:17:28 GET /folder/efg.png 200 cdn.example.com/style.css Mozilla... Firefox/31.0
16:17:38 GET /favicon.ico 404 - Mozilla... Firefox/31.0
This comes as a surprise to me because I have the following HTML code to tell browsers where to fetch the favicon on all my web pages.
<link rel='shortcut icon' href='//cdn.example.com/images/favicon.ico'>
Somehow, I still receive requests to example.com/favicon.ico occasionally even though Firefox did download the favicon from the alternate location. Is this behaviour peculiar to Firefox browsers or do I have to provide a favicon in the webroot to avoid 404 errors?
Further, if I provide both, which favicon would the browser use?
More posts by @Nimeshi995
2 Comments
Sorted by latest first Latest Oldest Best
I found that you don't have to specify favicon. just paste it to the root folder and it will sometimes automatically add it. You can specify favicon just in case for new browsers. The root folder is the best place to place favicon's, just a suggestion. Best regards.
Some bots and older browsers
Some bots and older browsers will ignore custom favicon paths and will attempt to fetch a locally stored favicon from the root /. A simple fix would be to copy the favicon from the CDN and store it locally on the site just to satisfy those bots and browsers, you could also setup a redirect using something like redirect 301 /favicon.ico www.example.com/favicon.ico
Potential problem
This may not be revelant as you may have just deleted it when copying it into the question but it seems that your code is invalid (If not let me know so I can delete this).
Invalid Code:
`<link rel='shortcut icon' href='cdn.example.com/images/favicon.ico'>`
HTTP Valid Code #1 :
`<link rel='shortcut icon' href='http://cdn.example.com/images/favicon.ico'>`
HTTPS & HTTP Valid Code #1 :
`<link rel='shortcut icon' href='//cdn.example.com/images/favicon.ico'>`
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.