Keeping Your Favicon Organized
Favicons are those little pictures that show up next to your site's name in a variety of places in web browsers.
It really helps your site stand out when user's have dozens of tabs open and creating them is simple. Just upload an image to any number of favicon generators and then save the resulting favicon.ico to the root of your website and the browsers will automatically find them.
But what if you don't want to have random icons filling up your website's project directory? What if you want to have them nicely kept in your imgs directory? We'll there are two solutions.
Solution one is to add the following line to your section. This will tell the web browsers where to look for the file.
<link rel="shortcut icon" href="/img/favicon.ico">
The only downside to this is that if for some reason this line doesn't get served (your user receives an error page that doesn't include it, you forget it) then they aren't going to get the file because the browser is going to default to looking for /favicon.ico. This is fixed with solution two which is adding the following line to your .htaccess file:
RewriteRule ^favicon\.ico$ /img/favicon.ico [R=301,L]
Scott Keck-Warren
Scott is the Director of Technology at WeCare Connect where he strives to provide solutions for his customers needs. He's the father of two and can be found most weekends working on projects around the house with his loving partner.
Top Posts
- Working With Soft Deletes in Laravel (By Example)
- Fixing CMake was unable to find a build program corresponding to "Unix Makefiles"
- Upgrading to Laravel 8.x
- Get The Count of the Number of Users in an AD Group
- Multiple Vagrant VMs in One Vagrantfile
- Fixing the "this is larger than GitHub's recommended maximum file size of 50.00 MB" error
- Changing the Directory Vagrant Stores the VMs In
- Accepting Android SDK Licenses From The OSX Command Line
- Fixing the 'Target class [config] does not exist' Error
- Using Rectangle to Manage MacOS Windows