Configure Browser Cache Settings of W3 Total Cache plugin

This is the fourth post in our series that explains how to set up W3 Total Cache plugin to achieve PageSpeed grade of 100.

Here we explain how to configure the Browser Cache Settings of W3 Total Cache plugin.

The Browser Cache Settings page has many sections, and we shall consider them one by one.

The screenshots from the Settings pages that you see here, are taken from narrow screens, to allow this post to be seen on narrow screens properly. These Settings pages on wide screens look a little bit differently, and we give links to the relevant screenshots.

W3 Total Cache configuration: Browser Cache Screenshot from W3TC plugin Page Cache settings page, General section. Check the following boxes: Set Last-Modified header, Set expires header, Set cache control header, Set entity tag (eTag), Enable HTTP (gzip) compression, Prevent caching of objects after settings change (with empty exception list), Don't set cookies for static files. Do not check: Set W3 Total Cache header.

Screenshot from W3TC plugin Page Cache settings page. General section continued: (not checked) Do not process 404 errors for static objects with WordPress, 404 error exception list: default. CSS & JS section: (checked) Set Last-Modified header, (checked) Set expires header, Expires header lifetime: 864000 seconds, (checked) Set cache control header, Cache control policy: 'cache with max-age...', (checked) Set entity tag (eTag). These settings are used to instruct the browser to cache the page files. They are relayed to the browser by means of headers which are prepended to the files so that you cannot see them when you view the files.

They are important: PageSpeed Insights will reduce your grade if you do not set them up fully, and your server load may increase.

Screenshot from W3TC plugin Page Cache settings page. CSS & JS section continued: (not checked) Set W3 Total Cache header, (checked) Enable HTTP (gzip) compression, (checked) Prevent caching of objects after settings change, (checked) Disable cookies for static files. HTML & XML section: (checked) Set Last-Modified header, (checked) Set expires header, Expires header lifetime: 3600 seconds, (checked) Set cache control header, Cache control policy: 'cache with max-age...', (checked) Set entity tag (eTag), (not checked) Set W3 Total Cache header, (checked) Enable HTTP (gzip) compression. On the other hand, incorrect settings may cause browser cache to become stale. Your users may complain that they do not see updates to your pages (e.g., the comments they have posted, and responses to them), and you may have to tell them to clear their browser cache to resolve it. (It happened to me as a user of someone else’s site and was quite humiliating for me as a knowledgeable user.) An admin may also run into a similar trouble with one’s own site. (This happened to me too, and was quite annoying.)

Screenshot from W3TC plugin Page Cache settings page. Media & Other files section: (checked) Set Last-Modified header, (checked) Set expires header, Expires header lifetime: 864000 seconds, (checked) Set cache control header, Cache control policy: 'cache with max-age...', (checked) Set entity tag (eTag), (not checked) Set W3 Total Cache header, (checked) Enable HTTP (gzip) compression, (checked) Prevent caching of objects after settings change, (checked) Disable cookies for static files. In my experience, W3 Total Cache plugin does an excellent job in this area if properly configured. In particular, marking Prevent caching of objects after settings change takes care of the stale cache.

In particular, we need to change many settings from their default values. My settings are shown on the screenshots.

Here the browser is instructed to cache CSS and JS files for 864000 seconds which is 10 days while html files are cached for 3600 seconds which is one hour. The reason for the difference is that CSS and JS files seldom change while html files change more often. PageSpeed Insights have been happy with these settings.

This is how this section of the Settings screen looks on a wide screen, continued, more and the rest.

Leave a Reply

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

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>