Do I need to have a favicon on my site? How do I get rid of the errors I see in my apache log?

后端 未结 7 1367
余生分开走
余生分开走 2021-02-18 21:48

I keep seeing favicon warnings in my apache log. How do I get rid of those? Do I have to have a favicon for my site?

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-18 22:17

    Johan Petersson provides a good answer to preventing file not found errors without using a favicon at http://www.trilithium.com/johan/2005/02/no-favicon/

    Placing the following code in the Virtual Host section of httpd.conf (or wherever you define your site environment), should stop the errors appearing in the Apache error log:

    # Don't bother looking for favicon.ico
    Redirect 404 /favicon.ico
    
    # Don't bother sending the custom error page for favicon.ico
    
        ErrorDocument 404 "No favicon
    
    

    Alternatively, you can create a blank file and name it favicon.ico, placing it in the root directory of the site.

提交回复
热议问题