Audio Version [click the globe to change language]

how to add expires headers to htaccess imageAdding 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 Tweet

So let’s do the usual prep stuff:

  1. backup your website
  2. download a copy of your htaccess file
Manually backing up your website is the least sexy task in WordPress, but a screwed up LIVE site is sheer hell.Click To Tweet

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:

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

Here’s a video walkthrough of how to add the expires headers code to your htaccess file

Here’s how to get to your htaccess file via cPanel – if you need it

guides and tools for seo

Similar Posts