2 min read(Last Updated On: December 31, 2017)

Hey, Hoz here. Today’s hack is going to give you the add expires headers htaccess code to use on your htaccess file. If you’re a WordPress user, doing it this way will save you having to use a plugin.

Adding expiry dates to your headers can significantly improve the performance of your website and is a great way to make WordPress faster.

Tweaking your website's performance on an ongoing basis is part and parcel of being a website owner.Click To Tweet

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.

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 how to get to your htaccess file via cPanel – if you need it

This was a Hoz tutorial on the add expires headers htaccess code featured on the Youtube Channel. Make sure you CLICK TO SUBSCRIBE to catch all the video updates!

Please Share This Content
Hey, I would really appreciate it if you share this content with your friends and followers :)?