【发布时间】:2018-05-25 11:55:11
【问题描述】:
在过去一周左右的时间里,我注意到在基于 Codeigniter 的网站上的日志中出现了很多奇怪的 404 错误。几个例子:
404 Page Not Found: Apple-touch-iconpng/index
404 Page Not Found: 404javascriptjs/index
404 Page Not Found: 404testpage4525d2fdc/index
404 Page Not Found: Faviconico/index
其中一些是存在的东西(apple-touch-icon.png),但 404 错误缺少文件扩展名,并且后面有一个“/index”。其中一些是甚至不存在的文件(404testpage4525d2fdc)。我已经浏览了整个站点以寻找损坏的链接,但没有。我也没有在实际站点上显示任何 404 错误 - 只是在日志中。
我的 .htaccess 文件:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
还有我的路线文件:
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route[LOGIN_PAGE] = 'users/login';
$route['landlords'] = 'listings/directory/1';
$route['complexes'] = 'listings/directory/2';
$route['managers'] = 'listings/directory/3';
$route['apartments/sublets'] = 'listings/index/13';
$route['apartments/roommates/19'] = 'listings/index/19';
$route['apartments/roommates/20'] = 'listings/index/20';
$route['apartments/roommates/21'] = 'listings/index/21';
$route['apartments/roommates/22'] = 'listings/index/22';
$route['apartments/roommates'] = 'listings/index/14';
$route['apartments/listings'] = 'listings/index/15';
$route['apartment-alerts'] = 'notification/add_notification';
$route['apartments/listings/([0-9]-(beds))'] = 'listings/index/$1';
就像我说的,网站本身似乎运行良好,但我无法弄清楚是什么导致这些错误出现在日志中。我试过寻找答案,但他们似乎都在处理网站上出现的 404 错误,并且是应该在服务器上的实际资源。任何帮助将不胜感激!
【问题讨论】:
-
可能只是垃圾邮件机器人抓取您的网站尝试潜在的网址。
-
尽管请求的资源看起来很奇怪(正如@delboy1978uk 所说):可能,某些浏览器期望在 HTML 标头中有一个 favicon。像苹果的 Safari 等?更多信息:stackoverflow.com/a/12683605/3095216
-
如果你能拿到服务器访问日志——如果你的服务器上设置了这样的日志——你也许能看到这些奇怪的请求来自哪里。
-
这就是我在 ci 中删除此功能的确切原因……我喜欢我的错误日志充满实际错误(如果它们发生)。任何 404 都不是因为我而发生的,而是因为某些用户/机器人访问了一个从未存在的 url。
-
所以这听起来像是机器人 - 有没有办法停止记录这些 404 或阻止它们?
标签: php codeigniter