12

There are always the log showing: file does not exist c:/wamp/www/favicon.ico in apache error_log. I used wampserver, why?

4

5 回答 5

18

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.

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>

Or, you create an empty file with the name “favicon.ico” in the directory root of Apache (for exemple /var/www/ , but no favicon will be shown by the browsers for your site).

于 2012-06-19T10:58:47.417 回答
4

Do you have a reference to the favicon.ico file in your HTML source?

<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

Even if you don't, many browsers try to access this file anyway when visiting a new page. Favicon is used when adding the website to favourites/bookmarks. Some browsers (for example Firefox) also display favicon on the website's tab on the top of the screen.

Your best bet would be to simply add an favicon.ico file with a 16x16 icon to the c:/wamp/www/ directory.

于 2012-06-19T10:50:51.060 回答
1

favicon.ico is the image that is showed next to the url in the address bar. Every browser search for it. For example the StackOverflow logo in this page.

于 2012-06-19T10:52:30.170 回答
0

see this http://nfolamp.wordpress.com/2010/06/28/apache-favicon-ico-does-not-exist-yes-its-truly-annoying/ (dead link)

the contents of that link are in the voted answer https://stackoverflow.com/a/11099560/876038

于 2012-06-19T10:52:24.940 回答
0

Try restarting your browser. I thought I had a major problem with this, but as it turns out, mozilla just caches sites favicons. Restarting it fixed the issue.

于 2016-08-14T11:41:55.963 回答