Search code examples
phpfavicon

How to force favicon to appear


Okay, so I've tried every variation of the link rel code, including the -moz and - webkit ones, that I could find. No luck so far, and I've come to the conclusion that it might be my host blocking automatic client-side downloads, which is in the terms of service. So, I was wondering if I could make a PHP script that forces it to display server-side. I'm hoping for something simple like

<php>
$favicon= ("/favicon.ico");
?>

Of course that's pseudocode and there are syntax errors, but what would I actually write to do this?


Solution

  • Echo this in your head section of your page

    <head>
      <?php 
          echo '<link rel="icon" href="/favicon.ico" />'; 
      ?>
    </head>