Search code examples
htmlwampfavicon

Setting the favicon for all pages


Following code is for displaying favicon:

<head>
    <title><link rel="icon" href="/favicon.ico" type="image/x-icon" /></title>
</head>

Path for my image is: wamp/www/widget_corp/favicon.ico.

The URL for page was: localhost/widget_corp/pat_apt.php.

Problem is: I cannot display favicon. Can anyone tell me why? Also, suggest me the way to display favicon for all pages. I went through some forums they suggested to edit the config file. Is that true? I am using WAMP Server 2.4.


Solution

  • Don't embed your favicon code in title tags. That's why you can't see it.

    To include same code in various pages, create a php file to contain your head information:

    header.php

    <link rel="icon" href="/favicon.ico" type="image/x-icon" />
    

    Then call it between head tags of all of your pages:

    <head>
      <title>My Title</title>
      <? require_once 'header.php'; ?>
    </head>