Today I ran the Google PageSpeed test to test my site speed. The site speed was ok, around 80/100, not bad but not that great. One of the items on the list was to improve the browser caching. I thought my super cache would be doing all that, but apparently it doesn’t. So I Google’d how to improve and leverage browser caching. I found a couple of sites, but this one from ‘Thomas Griffin’ was the one I used. It helped my site speed jump up to 88/100, a whole 8 percent! I was so surprised because it only took me 5 minutes to make the change. People were making comments that it didn’t work, so I was a little skeptical. I ran the Google Site Speed test an hour later and it was still 88/100. So I’m convinced, the Thomas Griffin way works.
Basically you need to change your .htaccess file on your web server and add in this code at the top of the file.
## EXPIRES CACHING ##<IfModule mod_expires.c>ExpiresActive OnExpiresByType image/jpg “access 1 year”ExpiresByType image/jpeg “access 1 year”ExpiresByType image/gif “access 1 year”ExpiresByType image/png “access 1 year”ExpiresByType text/css “access 1 month”ExpiresByType application/pdf “access 1 month”ExpiresByType text/x-javascript “access 1 month”ExpiresByType application/x-shockwave-flash “access 1 month”ExpiresByType image/x-icon “access 1 year”ExpiresDefault “access 2 days”</IfModule>## EXPIRES CACHING ##
I used telnet or ssh into my server to make the change. The file is in the public_html or html folder. It’s a hidden file because it’s named with a dot in front. Remember, always make a backup of the file before you make any changes. If you need help with editing the file, you should contact your web hosting administrator, they should be able to help you.
Thanks,