Stop Annoying favicon.ico 404 errors

If you’re like me, you don’t like cluttering your main folder with unnecessary files. This is why I hate that some browsers are still looking for ‘favicon.ico’ in the main folder even when you indicate in <head> that’s not where the agent should be looking…

Here is a way to eliminate those PITA 404’s from your error logs…

RewriteEngine On
RewriteRule ^favicon.ico$ folder/path/favicon.ico [R=301,L]

Hope it helps 🙂

2 thoughts on “Stop Annoying favicon.ico 404 errors

  1. Robert Post author

    You can also use the same logic for Apple touch icons 😉

    RewriteEngine On
    RewriteRule ^favicon.ico$ /image/favicon/favicon.ico [R=301,L]
    RewriteRule ^apple-touch-icon.png$ /image/favicon/apple-touch-icon.png [R=301,L]

    Reply
  2. Robert Post author

    Same effect without RewriteEngine On

    Redirect 301 /favicon.ico /image/favicon/favicon.ico
    Redirect 301 /apple-touch-icon.png /image/favicon/apple-touch-icon.png

    Reply

Leave a Reply

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