: This article mainly introduces the issues brought about by favicon. if you are interested in the PHP Tutorial, please refer to it. Favicon. ico introduction
What is favicon. ico? it may have become too common (I did this until I wrote this article). let's take a look at Wikipedia's explanation:
Favicon is the abbreviation of favorites icon, also known as website icon (web page icon), page icon (page icon) or urlicon (URL icon), below is the link http://zh.wikipedia.org/wiki/Favicon
To put it bluntly, most websites will display this small icon at the left of the open browser tab, which is favicon. ico.
How can I set this icon? how many of you are familiar with this small detail just like me, but I don't know how to set it up (here I will review myself, there are many details that make my face swollen, but I don't really know him. what's even more terrible is that I think I know him ......).
Favicon settings
How can we set this? the setting method is very simple. There are two methods:
It is placed under the root directory of the server by default.
Is to name the file favicon. ico can be stored in the root directory of the website. The browser will automatically request to obtain http: // host/favicon. ico, this request is not visible in the browser through F12, you need to use other tools (such as Fiddler) to view, or open the server access log, such as my, the nginx log displays the Webpage Icon request.
"13/May/2015:16:07:31 +0800" "192.168.X.X" "test.test.com" "200" "GET /favicon.ico HTTP/1.1" "4409" ......
Use the link label to modify the icon position and name of a webpage.
In this way, you can use the link label of html to set the position and name of the webpage chart, as shown in the following figure.
Notes
The browser caches the icon information. I tried firefox to request a favicon every other time (about 2 minutes). chrome needs to delete the data before sending a new request ~~
What is the impact?
This problem is found in the PHP Framework. The PHP framework uses pathinfo to parse routes. the routing mode is [mod/controller. method]. if they do not match, logs are recorded and 404 is returned. when I access a correct path, an error is reported that the route does not exist, but the interface returns OK, access to an incorrect route records two error logs. what is the problem? The following is my nginx configuration.
server { listen 80; server_name test.test.com; location / { root /export/adsz/boss/php/sphp; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; include fastcgi_params; rewrite ^/(.*)$ /index.php/$1 break; } }
Nginx configuration causes this problem. when a browser requests an interface, the ingress:
server { listen 80; server_name test.test.com; location = /favicon.ico { root /wwroot/public/images/; } location / { root /wwroot/; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; include fastcgi_params; rewrite ^/(.*)$ /index.php/$1 break; } }
Summary
After finding this cause and modifying it, I carefully looked at the nginx configuration and found that all other virtual hosts have matching rules for configuring this favicon. ico! Summary: Let's take a look at it and think about why. don't lose interest in many things.
The above section describes the issues that favicon has brought about, including related content, and hopes to help those who are interested in PHP tutorials.