A Brief Introduction to favicon and a simple favicon
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:
Copy codeThe Code is as follows:
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.
<Link href = "favicon_baoman.ico" type = "image/x-icon" rel = "icon">
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 is all the content of this article. I hope you will like it.