'How to add favicon image on browser title bar in website

I am trying this code

<head>
   <meta charset="utf-8">
   <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link href="<?php echo base_url();?>dist/img/favicon.png" rel="icon"> 

this is not working



Solution 1:[1]

Some more context would be useful to help solve this. Looks like you're using a framework or custom code as base_url isn't a standard PHP method. This answer might help Also standardly; browsers expect favicon files to live in the public root of a project.

Solution 2:[2]

Maybe you forgot "/"

<link href="<?php echo base_url();?>/dist/img/favicon.png" rel="icon"> 

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ed Giles
Solution 2 Soonang Rai