简体   繁体   English

防止找不到404页面:CodeIgniter中的Faviconico / index

[英]Preventing 404 Page Not Found: Faviconico/index in CodeIgniter

I have a CodeIgniter 3 application with log_threshold of 1. Most of the logs I get are 404 Page Not Found: Faviconico/index . 我有一个CodeIgniter 3应用程序, log_threshold为1。我得到的大多数日志都是404 Page Not Found: Faviconico/index I want to receive 404s in my logs, but not this one as it's not particularly useful or informative. 我想在我的日志中收到404,但不是这个,因为它不是特别有用或信息丰富。 I've created the following routes. 我创建了以下路线。

$route['Faviconico'] = 'general/empty_response';
$route['Faviconico/index'] = 'general/empty_response';

This is the general controller method empty_response . 这是常规控制器方法empty_response

// Serves nothing
public function empty_response()
{
    return false;
}

Visiting http://example.com/Faviconico/index directly in the browser no longer cause the log where as it use to, but somehow users are still causing this log to happen. 直接在浏览器中访问http://example.com/Faviconico/index不再将日志恢复到原来的位置,而是以某种方式使用户仍然导致该日志发生。

How can I prevent logging of 404 Page Not Found: Faviconico/index ? 如何防止404 Page Not Found: Faviconico/index日志记录404 Page Not Found: Faviconico/index

Many browsers look for a favicon to show next to the address bar. 许多浏览器都在网站栏旁边显示图标 Add a favicon.ico to your root directory and that error should disappear. 将favicon.ico添加到您的根目录,该错误应消失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM