Mobile app version of vmapp.org
Login or Join
Murray432

: Yandex.Metrica: can I redirect from /favicon.ico to the 1×1 gif counter? I have a very simple site, with no graphics, and I don't want to spoil it with a huge JavaScript monitoring loop. I

@Murray432

Posted in: #Favicon #Metrics #Yandex

I have a very simple site, with no graphics, and I don't want to spoil it with a huge JavaScript monitoring loop.

I don't have a favicon.ico, and I always see 404 requests from browsers requesting for favicon; can I 307 the favicon location to the //mc.yandex.ru/watch/id URL of the 1×1 gif counter, the one which shows in the img src when you request the Metrica code from Yandex?

location = /favicon.ico {
return 307 mc.yandex.ru/watch/XXX; }

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Murray432

3 Comments

Sorted by latest first Latest Oldest Best

 

@Murray432

location = /favicon.ico {
return 307 mc.yandex.ru/watch/XXX; }


seems to work; however, it would seem like only certain browsers request a favicon.ico by default, so, not all visitors would be counted.

Also, it has a limitation of not letting you know which pages are popular on your site: when a redirect is made, it is likely that the Referer would be the /favicon.ico location, and not the location for which the favicon is allegedly loaded.

10% popularity Vote Up Vote Down


 

@Phylliss660

Browsers tend to cache favicons for longer than normal files, so trying to use it as your counter would probably make the counter quite unreliable. Even if it worked this would slow down your page unnecessarily, since you're adding a redirect into the mix.

Just stick with the standard code, and if the favicon errors are a problem use one of the options bybe mentioned. Adding an empty favicon with a long expires header is generally the best solution, since this gets rid of the errors and reduces the volume of requests (for regular visitors).

10% popularity Vote Up Vote Down


 

@Nimeshi995

Certain browsers will always search for a favicon and will carry on doing so until you place the file. There is absolutely no reason why you should need to put a 307 or any other redirect method for that matter simply to get rid of a 404 error.

404's does not imply your site is broken

It's important to note that errors 404 does not indicate that something is broken on the site, if a browser is requesting a file that simply doesn't exist on your server then a 404 response is completely valid.

Redirecting a Favicon 404

Redirecting a favicon with 307 is a bad idea, browsers will still request the file and by adding a 307 you are adding an additional request to your server therefor adding delay unnecessary on the page.

Solutions

You can design a favicon even though the rest of the site uses no graphics doesn't mean you can't have a favicon. It's actually rather good for tab bars in modern browsers.

Upload a 0 byte favicon.ico to your server, but that means the default browser favicon will not be displayed

Best method - Remove these errors from your logs, you can filter out this information from your logs and that way you never see them... Remember browsers will always request this file and even with redirect it doesn't stop the problem - redirecting is fixing nothing but more of a cosmetic fix for your logs, the correcy way is to filter these errors from your logs.. In Apache you can remove these errors by using:

Redirect 404 /favicon.ico

<Location /favicon.ico>
ErrorDocument 404 "No favicon
</Location>


For alternative server platforms you should find many solutions on Stack Overflow and Google.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme