Add expires headers to WordPress

Trying to speed up your WordPress website? You could try to add expires headers into your WordPress .htaccess file to help with this.

Add expires headers to .htaccess file

To add expires headers into your WordPress .htaccess file without a plugin, follow the steps below:

  1. FTP into your WordPress website’s server.
  2. Open your .htaccess file, located in the root of your WordPress installation.
  3. Copy and paste in the code from below.
  4. Save and re-upload accordingly.
<FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css|woff)$">
ExpiresActive On
ExpiresDefault A2592000

Note, you can also edit your .htaccess file without using an FTP if you have Yoast SEO installed.

Using a plugin to add expires headers

Using the WP Fastest Cache plugin, you’re able to instantly add the expires headers into your .htaccess file without any coding necessary.