Favicon not displaying on production


I’m setting my page favicon using this code

<link rel="icon" type="image/png" href="<?= $site->url() ?>/assets/favicon/favicon.png">

And it works in localhost, but not in a production hosting. When I follow the path it takes me to an error page, as if the path ‘/assets/favicon…’ was a page of the site.

I think it might be a routing error, but I have not been able to determine where exactly the error might be, any ideas?

I also tried using <link rel="icon" type="image/png" href="<?= url('assets/favicon/favicon.png') ?>">

Make sure that the file actually exists in the given location and that you don’t have a typo.