Mobile app version of vmapp.org
Login or Join
Nimeshi995

: 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

@Nimeshi995

Posted in: #Error #Favicon

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?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Nimeshi995

2 Comments

Sorted by latest first Latest Oldest Best

 

@Gonzalez347

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.

10% popularity Vote Up Vote Down


 

@Nimeshi995

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'>`

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme