Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Favicon in subdirectory all subdomain

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?

like image 910
Trufa Avatar asked Nov 08 '10 22:11

Trufa


People also ask

Can I put favicons in a folder?

To add a favicon to your website, either save your favicon image to the root directory of your webserver, or create a folder in the root directory called images, and save your favicon image in this folder. A common name for a favicon image is "favicon.ico".

Should favicon be PNG or SVG?

SVG would be nice, but is not supported by all browsers. So the easiest solution is still to just use PNG images. Google explicitly says they don't support 16x16 or 32x32 icons. For Google results, you need to include at least one icon that is a multiple of 48x48.

What is http * * favicon ICO?

The favicon. ico file is a small graphic icon that is used by some browsers (including Microsoft Internet Explorer and Mozilla Firefox) to enhance the display of address bar information and "favorites" bookmark lists. When requesting a resource, these browsers also try to locate the site's custom favicon. ico file.

Can favicon be 32x32?

The optimal size for creating a favicon is 16x16 pixels, which is the size in which they are most commonly displayed. However, they can appear in larger dimensions too (such as 32x32 pixels).


2 Answers

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.

like image 162
Pekka Avatar answered Oct 12 '22 19:10

Pekka


Adding the <link> element is the right way to go. Use a template engine (e.g. Template-Toolkit) to avoid duplicating common content manually.

like image 31
Quentin Avatar answered Oct 12 '22 17:10

Quentin