A Beginners Guide to Browser Caching

browser icons

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.

{codecitation}

## 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 ##{/codecitation}

Instructor

  • Steve is the founder of OSTraining. Originally from the UK, he now lives in Sarasota in the USA. Steve's work straddles the line between teaching and web development.

0 0 votes
Blog Rating
Subscribe
Notify of
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
bwls

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.

1
0
Would love your thoughts, please comment.x
()
x