Brief introduction to favicon and simple favicon_PHP tutorial

Source: Internet
Author: User
Tags php framework
Let's briefly talk about favicon and simple favicon. Favicon: faviconfavicon. ico introduction favicon. ico is something that you may get used to. (that's it. I don't know how to simply talk about favicon or favicon until I write this article.

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:

The 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

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" "" "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.


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;   location / {     root /export/adsz/boss/php/sphp;     fastcgi_pass;     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;  location = /favicon.ico {    root /wwroot/public/images/;  }   location / {     root /wwroot/;     fastcgi_pass;     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;   } }


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.

When favicon. ico is introduced, what is favicon. ico? maybe I get used to it too much (that's what I do, I don't know until I write this article...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.