Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot get Favicon.ico to display

Tags:

html

favicon

I have copied my favicon.ico file to my Apache document root. I had to add an Apache Rewrite exception for it and now it is accessible from www.example.com/favicon.ico. But when I hit my main URL it does not show up.

I thought all you had to do was copy the file with the correct permissions into the doc root? Do I need to make php changes? Thanks!

like image 886
roacha Avatar asked Feb 04 '10 16:02

roacha


2 Answers

the favicon.ico reference must be an absolute URL, not relative. Using this:

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

My status was

favicon.ico () shows up in:

    IE 9.0.8
    Safari 5.1.7 

Fails in:

    FF 28.0
    Google Chrome 34.0

changing to absolute values

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

causes all browsers to locate and display the favicon.ico

like image 153
jobeard Avatar answered Sep 18 '22 03:09

jobeard


Try throwing this tag in the head of your document:

<link href="/favicon.ico" type="image/x-icon" rel="icon" />
like image 34
just_wes Avatar answered Sep 17 '22 03:09

just_wes