---
title: "apache 关闭 favicon.ico 不存在时的error_log"
author: "xiaojiit"
date: "2013-03-14T15:34:48Z"
tags: []
categories: ["Web前端"]
slug: "apache-favicon-ico-error-log"
draft: false
lastmod: "2013-03-14T15:34:48Z"
id: 1829374
url: "https://sharejava.iteye.com/blog/1829374"
---

当网站根目录中没有 favicon.ico文件时，

Apache会记录 File does not exist: /opt/apache2/htdocs/favicon.ico的错误日志到error\_log中，

通过以下方式进行解决：

 

**1.在apache配置文件中添加以下配置**

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

 

 **2.在网站目录中添加favicon.ico，让其变的存在。**