Cache Rules Everything Around Me

When it comes to speed, one of the easiest things someone hosting their own WordPress install can do is enable expires headers. Expires headers basically tell the browsers visiting your site to cache the static stuff — like images and scripts — so they don’t have to be downloaded every time one of your pages needs them.

To do this, I’ve been using some fairly straightforward .htaccess rules that I adapted from the ones in HTML5 Boilerplate. But since version 4.0 of Boilerplate came out about a week ago, I went in and cleaned things up a bit. And now that everything is looking good, I figured that I should probably share them.

So here are the new & improved rules I’m using:

All you need to do to benefit from this is add the code above to your site’s .htaccess file. Just make sure you don’t have any rules pertaining to expires hanging around from an old plugin or something else and you should be golden.