Audio Version [click the globe to change language] |
Adding expiry dates to your headers can significantly improve the performance of your website and is a great way to make WordPress faster.
In this quick post, I’m going to give you the add expires headers htaccess code to use on your htaccess file.
I’ll also walk you through it in the video below.
If you’re a WordPress user, doing it this way will save you having to use a plugin.
The downside of doing it this way is that you have to remember to edit the file and change the expiry dates when those dates are ‘up’, and unless you’re on the meticulous side, that’s an easy thing to forget, especially if you’re dealing with multiple websites.
Tweaking your website's performance on an ongoing basis is part and parcel of being a website owner.Click To TweetSo let’s do the usual prep stuff:
- backup your website
- download a copy of your htaccess file
Once you’ve got that out the way, here’s all you do:
- Step 1: edit your htacess file and paste the code below.
- Step 2: press save.
- Step 3: check your website hasn’t exploded.
And here’s the code:
Contents
Add Expires Headers htaccess code
<FilesMatch “\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)(\.gz)?$”>
Header set Expires “Mon, 4 Nov 2018 21:00:00 GMT”
Header unset ETag
FileETag None