Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put favorite icon outsite the web site root folder

Tags:

favicon

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?

like image 467
sparrows81 Avatar asked May 20 '13 13:05

sparrows81


People also ask

Does favicon have to be in root?

If you're a web page webmaster and cannot get the favicon. ico to display, make sure the icon is in the root directory with the proper permissions.

How do I save favicon in root directory?

If you only want one favicon for your entire domain, simply save the favicon. ico file to the root folder of your site. When uploaded, it must be accessible from http://www.yourdomain.com/favicon.ico . As soon as you upload the file, your browser should start displaying the icon for all pages on your site.

Where do I put the fav icon?

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".


2 Answers

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).

like image 51
philippe_b Avatar answered Nov 13 '22 00:11

philippe_b


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

like image 28
Patrice Levesque Avatar answered Nov 13 '22 00:11

Patrice Levesque