Simply talk about Favicon, a simple favicon_php tutorial

Source: Internet
Author: User
Tags php framework

Simply talk about Favicon, simple favicon


Favicon.ico Introduction

Favicon.ico is a thing, maybe too much to be used to (I am so, until I wrote this article before I know), to see the Wikipedia explanation:

Copy the Code code as follows:
Favicon is the abbreviation for Favorites icon, also known as the website icon (page icons), page icon, or Urlicon (URL icon), the following is the link Http://zh.wikipedia.org/wiki/Favicon

In fact, it is this thing, most of the Web site will open the Browser tab at the leftmost display this small icon, this is Favicon.ico

This icon how to set, how many classmates and I like to this small detail accustomed to, but do not know how to set up a hand (here to review their own, there are a lot of details of the face can bump swollen, but I do not really understand him, more terrible is my subconscious think I know him ... )。

Favicon Settings

How to set this up, the Setup method is very simple, there are two ways:

The default is placed under the server root directory

is to name the file Favicon.ico and put it in the root directory of the site, the browser will automatically request to get http://host/ Favicon.ico, this request in the browser through the F12 is not visible, need to use other tools (such as fiddler) to see, or open the server access log, such as me, the Nginx log will display the page icon request
"13/may/2015:16:07:31 +0800" "192.168.x.x" "test.test.com" "$" "Get/favicon.ico http/1.1" "4409" ...

Fix page icon location and name via link tag

The way to do this is to set the location and name of the page diagram through the HTML link tag, just like this

Watch out.

Browser will cache the information of the icon, Firefox I tried the next is every time (about 2 minutes) will be requested Favicon,chrome to delete the data can be re-request ~ ~

What's the impact of this?

Found this problem because the PHP framework, PHP framework through the PathInfo to parse the route, the route is "Mod/controller.method", if not match the log and return 404, I access a correct path will also say that the route does not exist, But the interface return is OK, access to an incorrect route will log two error logs, this is what happened, here is my nginx configuration

server {   listen  ;   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 the browser requests an interface, the default is to bring the http://test.test.com/ Favicon.ico, this time to report the way out by mistake, the browser issued two requests, one that we want, and the other is the ICO page icon request, this problem solving method is very simple, just need to add this diagram in the configuration or the Favicon request to locate other places:

server {   listen  ;   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;   }}

Summarize

Find this reason and modified, I looked at the Nginx configuration carefully, found that other virtual hosts have configured this favicon.ico matching rules! I'm so embarrassed ... , summed up, is to look more, think about why, do not lose interest in a lot of things,

The above mentioned is the whole content of this article, I hope you can like.

http://www.bkjia.com/PHPjc/1014436.html www.bkjia.com true http://www.bkjia.com/PHPjc/1014436.html techarticle simply talk about Favicon, simple favicon Favicon.ico introduce favicon.ico is what things, perhaps too many are accustomed to (I am so, until the article before I know ...

  • 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: info-contact@alibabacloud.com 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.