Is putting your favicon.ico file in a non-root path a bad idea?

Remember that not all requests to your site are for HTML pages! Requests for non-HTML content, like bare image files (e.g, viewing http://example.com/image.jpeg directly in the browser), cannot see a <link> tag. Therefore, they must fall back to searching for the shortcut icon in the standard location at /favicon.ico.

This still doesn’t mean that this needs to be the canonical location, though! You can still keep it in /images/favicon.ico if you want – just make sure that a redirect is in place from /favicon.ico to wherever your preferred location is.

Leave a Comment