Adding Expires Module To Optimize W3 Total Cache and Improve Your Pingdom Score

Digital Ocean allows you to easily build a web server pre-configured for WordPress using their One-click apps. One apache module that is not installed and enabled by default is the expires module, a very beneficial tool for setting cache related settings on CSS, JS, images (and more) for your visitors. Many web hosting companies do not come with the expires module installed and enabled by default.

W3 Total Cache

The expires module allows you to set cache expiry dates for all file formats but most importantly your CSS, JS and¬†images. Without this module installed W3 Total Cache will not work to it’s fullest capability as your website will not be leveraging browser caching to set long expiry headers on your files. This will also negatively affect your website performance score on websites like Pingdom.

Log into your server using SSH, the most common tool is to connect to your server is Putty, and run the following commands:

SSH Commands

sudo a2enmod expires

sudo service apache2 restart

The Results

After your expires module is enabled your css, js and images will have a long expiry set in your .htaccess and visitor browsers cache.

Leave a Reply

Your email address will not be published. Required fields are marked *

Join Newsletter

About Me

Senior Application Developer. Focused on WordPress, Magento, Web Security & Server Optimization. I also contribute to open source projects when I can.

I have a growing family and spend most of my free time with them, working on my personal health and fitness or small home improvement projects.