Self built automatic access website Favicon icon api

2024-02-21 Published on Wordpress usage

Basically, every website should have a favicon image, which is a small icon displayed on the title bar of the browser. It will be displayed when opening a page or adding a page to a favorite.

Download source code

Github: https://github.com/owen0o0/getFavicon
Gitee: https://gitee.com/iowen/getFavicon

Installation and use

  • Upload to the root directory of the website or the favicon folder
  • The cache folder gives 755 permissions
  • Then visit http://you.url/favicon/get.php?url=https://www.iowen.cn
  • It is recommended to delete the cache and try again if the data cannot be obtained
  • notes : In the text faviconw For the api folder, set as appropriate

Customizations

 /*------ Parameter Setting ------*/ $defaultIco='favicon.png';   // Default icon path $expire = 2592000;           // The cache validity period is 30 days, and the unit is: seconds. When it is 0, no cache is available /*------ Parameter Setting ------*/

Pseudo static

In order to facilitate cdn caching, pseudo static can be configured. If cdn is not used, it can not be configured.

 Select corresponding rules according to the environment: #Nginx rule rewrite ^/favicon/(.*)\.png$ /favicon/get.php? url=$1; #Apache rules <IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^favicon/(.*)\.png$ favicon/get.php? url=$1 [L] </IfModule>

Call method

Pseudo static not configured: http://you.url/favicon/get.php?url= https://www.iowen.cn

Configure pseudo static: http://you.url/favicon/ www.iowen.cn .png

The bold part is the target station URL. Note the difference between the two methods

Affordable CDN

High flow CDN: Bracket cloud http://kuocai.cn/register?code=89pggndfhhn69 , 30G of traffic will be given away through link registration, and 30G of traffic will be given away every month after real name, so the traffic package is also affordable.

自建自动获取网站 Favicon 图标 api

 

Still a problem? How can we help you?
 One Nav navigation theme