Leverage Browser Caching with .htaccess
I was working on a WordPress site But whenever I ran PageSpeed test on the site, it keeps giving me red lights to ‘Leverage Browser Caching’ and ‘Enable Compression’, forget PageSpeed of Google if you go to www.gtmetrix.com and check your speed you will see red line of having low or no Leverage Browser Caching.I tried many Cache Plugins such as WP CACHE, HYPER CACHE etc Now i am going to show you how to fix this issue through .htaccess, its pretty simple just copy the code below and paste into you htaccess file and see the difference.
Enabling Compression with .htaccess
If you dont know what Gzip Compression is you can go to this article https://developers.google.com/speed/articles/gzip and learn about it,its pretty useful technique to speedup websites,With following code on htaccess file, we’ll be enabling Gzip compression on the server. It’ll reduce the size of HTTP response. Almost all web browsers claim to support it. Add following code at the end of
.htaccess file to enable compression.
Written by Talha Zahid