Redirecting favicon.ico automatically

One of the overlooked web urls is the favicon.ico. To those unfamiliar, it’s the url that all web browsers and crawlers automatically try to access when viewing a website, and it’s the icon that is used for that website in user interfaces or in references to its content.

While it’s possible to tell browsers and crawlers to use a different url for a webpage’s icon using html meta tags, such as the link element in the head of a document, the favicon.ico is still used before the client knows of the correct icon url. If the favicon.ico resource does not exist, the client would receive a 404 not found error for this automatic process.

That may not seem like a problem since the client would eventually be made aware of the correct url, but consider when accessing a document that does not specify the icon url in its head, or the requested resource isn’t even html. Or perhaps the website designer made an icon that isn’t in the .ico format.

Using Nginx, it is possible to redirect the automatic requests of favicon.ico to the correct icon url. And if the html specifies its own icon, the client will still use that. The following code will do just that, anywhere, anytime.

location = /favicon.ico {
return 302 $scheme://$host/favicon.png$is_args$args;

In the above, an assumption has been made that the true icon exists as favicon.png, instead of in .ico format. When adding this to Nginx, be sure to change that to the correct url of the icon.

With the above in place, now web browsers and crawlers in search of a website’s icon will be able to find it, even if it doesn’t exist at favicon.ico, because they will follow the redirect to the correct place. And any document that specifies its own icon will still keep its icon.

My Linux Cheatsheet

One of the best tools I have in my arsenal of knowledge about Linux and working with *nix systems, is my cheatsheet.

It’s been curated over many years and I’ve memorized most of it. On occasion, I still need to reference it for one thing or another, either for hobbies or while at work professionally. It’s also been the topic of discussion a few times with my peers.

What is a Linux Cheatsheet?

Put simply, a Linux Cheatsheet is a file that lists a bunch of different quick commands that may be helpful tools to aid in the user performing a task on Linux.

One example, is that Linux from the command-line, doesn’t make it easy to search and replace a string in a bunch of files recursively. Doing so is useful if one is working inside of a project repository and needs to update all places in code where a certain word or phrase is used. This is where a cheatsheet can be helpful. The cheatsheet provides the quick command that does just that, without having to go and look it up on the Internet and getting a variety of results that may not even be what is exactly needed.

The Cheatsheet

My version of a Linux cheatsheet exists on a Gist webpage on my GitHub account. It’s publicly available:


So the next time you need a quick command, search no more. Place it on a cheatsheet. It’ll save you time in productivity the next time you need it.