Performance Optimization: Add Expires Headers

Similar to enabling GZIP compression, adding expires headers is an easy way to boost your site’s performance.

Expires headers are caching directives, and they improve your effective website speed for returning visitors and those who view multiple pages per visit.

Using an FTP client, edit your .htaccess file, locate the end of the WordPress permalink rewrite code (the last line should say # END WordPress), and add the following code:

## EXPIRES HEADER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/svg "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES HEADER CACHING ##

Note: These instructions are for Apache servers. If your site runs on an NGINX server, you’ll need to talk to your host about adding expires headers.