How to set Favicon in Codeigniter

tchaymore picture tchaymore · Aug 13, 2010 · Viewed 36.9k times · Source

I know this is a stupid question, but I can't find the answer anywhere. If I'm using Codeigniter, where do I save my favicon file so that it will pop up in the browser? Or is there a config option in the files that I haven't been able to find yet? This is driving me crazy!

Thanks a lot for the help.

Answer

David picture David · Aug 13, 2010

It depends on your organization. I usually put the favicon.gif file in the web root folder, so the URL would be yourdomain.com/favicon.gif

Then you have to add the following line of code into your HTML <head>:

<link rel="icon" href="<?=base_url()?>/favicon.gif" type="image/gif">

Assuming that the URL Helper is loaded in CodeIgniter. You can load it via $this->load->helper('url'); or add it into the autoload helper array in your config folder.