Reputation: 26281
Given the following script:
<?php
syslog(LOG_INFO,'$_GET: '.print_r($_GET,1));
var_dump($_GET);
?>
Using http://www.example.com/testing/chrome.php?x=123 as the URI produces the expected results:
array(1) { ["x"]=> string(3) "123" }
But when viewing the system log and Apache access log, I have another GET variable named "cid" whose value is "favicon.ico" when using the Chrome browser Version 39.0.2171.71 m (but not FF or IE).
What causes this, and is there a way to prevent my server from being hit twice for each request?
System Log
Dec 7 07:33:09 devserver test: $_GET: Array#012(#012 [x] => 123#012)
Dec 7 07:33:09 devserver test: $_GET: Array#012(#012 [cid] => favicon.ico#012)
Apache Log
192.168.1.1 - Michael [07/Dec/2014:07:33:09 -0800] "GET /testing/chrome.php?x=123 HTTP/1.1" 200 36 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36"
192.168.1.1 - Michael [07/Dec/2014:07:33:09 -0800] "GET /favicon.ico HTTP/1.1" 200 46 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36"
Upvotes: 1
Views: 1256
Reputation: 180023
What causes this, and is there a way to prevent my server from being hit twice for each request?
Chrome and other browsers will look for your site's favicon in /favicon.ico
. Put an empty file there rather than having your script handle that URL and you should be all set.
Upvotes: 3
Reputation: 91
Best way to avoid this is by adding a empty favicon
<link rel="shortcut icon" href="#" />
Upvotes: 0