Get rid of favicon.ico 404 errors with rails

Every time your browser loads an new url, it also request a file
called ‘favicon.ico’ in the same subdirectory. This generates a LOT of
errors in the Ruby on Rails logs of my app.

One way to avoid those errors is to redirect the browser to the root /favicon.ico file.
Just add this line in the /public/.htaccess file of your rails project :

 RewriteRule ^(.*)favicon.ico$ favicon.ico [QSA]

Do you use another method to resolve this problem ?

This entry was posted in Ruby on Rails and tagged , , , . Bookmark the permalink.

One Response to Get rid of favicon.ico 404 errors with rails

  1. Coren says:

    Yep, a favicon in the layout + an icon tag in the atom feed.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>