Favicon in subdirectory all subdomain

Trufa picture Trufa · Nov 8, 2010 · Viewed 11.9k times · Source

I am used to just save the favicon.ico in the public_html folder for adding the favicon.

The problema I have now is that I want to display the in all the files of a certain subdirectory, ( example.com/example "onwards" ) just putting it there, doesnt seem to do the job.

I know I could go document by document and add:

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

But I hope there is a more practical way, first I thought there might be a way trough CSS but that doesnt seem to be the case.

This would have come in handy because every document already includes:

<link rel="stylesheet" type="text/css" href="test.css" />

So any ideas or workarounds to how to solve this?

Answer

Pekka picture Pekka · Nov 8, 2010

You will have to specify the favicon using the link rel=... notation.

Browsers will search only in the root directory of the domain for a default /favicon.ico. Any variations from that you have to specify explicitly.