I read that the browser is looking automatically for a favicon.ico - is that also the case in an Android WebView element? Should I include a favicon.ico to a PHP page like below, to avoid a 404 error in my logs?

<?
//PHP CODE...
?>
<!DOCTYPE html>
<head>
<title>Hello world</title>
</head>
<body>
<--
Content...
-->
</body>
</html>
有帮助吗?

解决方案

This happens because (almost every) browser searches for a favicon by default. If the accessed page don't inform a valid URL for it, Apache uses the root directory.

You have two choices. You can create a website icon for each of your websites, or you tell Apache not to log that event as an error message.

1).

If you choose the second option, add the following code to each VirtualHost, or at least the ones which don’t have a favicon file:

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

2).

There is no way to stop browsers requesting it. You can either create a favicon, or create a zero byte file called favicon.ico and place in the web root.

其他提示

Yes, you can add an empty favicon.ico file. But of course the file itself, in the document root of your site, but not just a link in HTML code.

It'd be better to put favicon on the document root.

Just put dummy or blank favicon file into your page..sometimes it gives error if you keep blank path in favicon selector..

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top