sparrows81
sparrows81

Reputation: 431

Put favorite icon outsite the web site root folder

I need to put favicon.ico outside the root of the web site. Can i place it in another path or it may penalize some old browser?

Upvotes: 11

Views: 15491

Answers (2)

philippe_b
philippe_b

Reputation: 41418

If you put favicon.ico in another directory and declare it in the HTML (eg. <link rel="shortcut icon" href="/icon/favicon.ico">), the favicon will work, including on IE5, the first browser to support favicons. However, you will encounter the following (minor) drawbacks:

  • IE (and maybe some others) will look for /favicon.ico no matter what. Expect some 404 errors in your HTTP server logs.
  • Some browsers, like Chrome, will use favicon.ico even if you also declare high resolution PNG favicon pictures. Of course, if you only use favicon.ico as the favicon picture, this is not a concern.

In general, this is a good practice to put all favicon-related file in the root directory of the web site. See http://realfavicongenerator.net/faq#why_icons_in_root for more information (full disclosure: I am the author of this page).

Upvotes: 17

Patrice Levesque
Patrice Levesque

Reputation: 2114

Some browsers will always check for favicon.ico in the root folder. Won't break anything if absent, though.

Upvotes: 3

Related Questions