0

I'm aware that doing so in HTML is as simple as this:

<link rel="icon" href="/favicon.ico" />

However, I have a PHP site, in which:

DirectoryIndex index.php

to direct the user directly to the main page.

I can't seem to find a way to get a browser tab icon. What have I tried?

I tried to echo HTML inside index.php with the code, which didn't work. I also tried placing the line of code in some other working header HTML from within index.php. Google has nothing... literally.

The image is a .ico, called 'favicon.ico', is in root, and is recognized as a valid ico file.

Any help?

Aric Leather
  • 7
  • 1
  • 2

1 Answers1

2

By default, you actually don't need anything in your HTML for a favicon. Simply having a valid favicon.ico in your root should be enough.

Sometimes, when changing favicon you need to clear your browser cache for that site. Also, try accessing the favicon.ico directly: http://example.com/favicon.ico and make sure you can load it.

Here's a good resource about favicons: HTML 5 Favicon - Support?

Community
  • 1
  • 1
EasyCo
  • 2,036
  • 20
  • 39
  • Again, I'm aware of that. I'm running pure PHP. In my root folder, I have index.php, themes, .htaccess, favicon.ico. No HTML! – Aric Leather Oct 27 '14 at 00:01
  • @AricLeather AFAIK that shouldn't matter. I'm assuming you're using Apache to serve your php file(s)? Are you able to open the `favicon.ico` from your browser directly as indicated in my answer? – EasyCo Oct 27 '14 at 00:25
  • Yes, I can open favicon.ico from my browser. – Aric Leather Oct 27 '14 at 00:40