A Beginners Guide to Browser Caching
Is your website running slowly? Does your site have a lot of repeat visitors? Browser caching is one tool to help your site load much more quickly.
Every time someone looks at a page or an image the browser keeps a copy of it. Then if you request that page again within a certain amount of time, rather than run out to the internet to grab a new copy, it just gives you the locally saved version. This make the internet feel much faster.
In the video below, we’re going to help you understand and use browser caching.
This advice is part of our Speeding up WordPress class, but it applies to all sites.
{snippet wp-browser-caching}
Here’s the code that Topher references for your .htaccess file.
## EXPIRES CACHING ## ExpiresActive On ExpiresByType image/jpg "access plus 1 year" ExpiresByType image/jpeg "access plus 1 year" ExpiresByType image/gif "access plus 1 year" ExpiresByType image/png "access plus 1 year" ExpiresByType text/css "access plus 1 month" ExpiresByType application/pdf "access plus 1 month" ExpiresByType text/x-javascript "access plus 1 month" ExpiresByType application/x-shockwave-flash "access plus 1 month" ExpiresByType image/x-icon "access plus 1 year" ExpiresDefault "access plus 2 days" ## EXPIRES CACHING ##
I tried this on my localhost joomla site and it broke it.. Renders 500 error. Removed from .htaccess and all is back to normal.
Could this be because I am on a localhost? Or would my SEF Joomla! settings interfere.