Since a while, the modern web browser has what it is called the cache. A web browser cache is just space on your computer where you store your latest object if those objects are requested your computer won't need to download them again, instead, it gets from the cache; local storage will be always faster than downloading from the Internet. Now think on your website, and think on all the CSS, JS and image files you are using (GIF, JPEG, PNG, WEBP, etc.); imagine all the time that can be saved when your guesses visit the second page on your website.
Apache has a very nice feature (turned off by default), that compresses the content of the page. Instead of sending the raw HTML file, it does a gzip or deflate compression and it sends a smaller file. It is faster to load a 2 kB file than a 10 kB. And as a consequence, this improves your loading time.
Again, don't forget that Google rewards fastest websites, in other words, it improves your SEO.
In this post, I'm going to show you how to configure the .htaccess file to maximize local cache utilization.
.htaccess Configuration to improve your SEO
Here it is my configuration. Change it to fit your needs.
ExpiresByType image/vnd.microsoft.icon "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0 no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip
Header append Vary User-Agent env=!dont-vary
Header unset ETag
If you use another mime-type you can just added. But this combination should be enough for a generic website.
Enjoy!blog comments powered by Disqus