Been working on SEO performance tweaks, trying to get this website to be as efficient/fast as possible without removing important features.

I’m really close to exceptionally good results testing with most page speed testing tools: Google PageSpeed Insights, Pingdom Tools, GTMetrix, WebPageTest, and Google Lighthouse (Chrome built in version and Chrome Extension version).

As I was getting closer and closer to perfection I ran into a stubborn issue with the sites favicon.ico file being reported as an issue by the GTMetrix testing tool under “Specify a cache validator”.

GTMetrix Specify ETag header to enable cache validation Warning for favicon.ico

GTMetrix Specify ETag header to enable cache validation Warning for favicon.ico

Specify a cache validator:
The following resources are missing a cache validator. Resources that do not specify a cache validator cannot be refreshed efficiently. Specify a Last-Modified or ETag header to enable cache validation for the following resources:

: https://seo-gold.com/favicon.ico

It’s a minor issue, one tiny file apparently not being cached, but I’m supposed to be an SEO expert, so should be able to fix this :-).

W3 Total Cache Browser Cache Options

I use the W3 Total Cache WordPress Plugin for the majority of cache related performance optimisation and have the plugin set to add the relevant Last-Modified Headers and ETag Headers rules to the sites .htaccess file.

You can see in the screenshot below both options are ticked:

W3 Total Cache Browser Cache Options

W3 Total Cache Browser Cache Options

Set Last-Modified header (ticked)
Set the Last-Modified header to enable 304 Not Modified response.

Set entity tag (ETag) (Ticked)
Set the ETag header to encourage browser caching of files.

I also have the corresponding General Options (at the top of the Browser Cache options page) set as well.

The above options should result in the favicon.ico file being cached correctly, so it shouldn’t throw up a “Specify a Cache Validator” warning.

Looking through the sites root .htaccess file (where the W3 Total Cache Plugin rules are saved to) there’s relevant browser cache rules for the favicon.ico file.

W3 Total Cache Browser Cache .htaccess Rules for Favicon.ico file

W3 Total Cache Browser Cache .htaccess Rules for Favicon.ico file

AddType image/x-icon .ico
ExpiresByType image/x-icon A2419200

This should work, but according to GTMetrix it wasn’t working.

After some head scratching and 20 minutes of Google searches looking for others reporting this issue and not finding anything helpful I looked closer at the W3 Total Cache options and didn’t find anything wrong.

Next I went through the W3 Total Cache Plugin .htaccess rules line by line and finally spotted the problem with one set of W3 Total Cache rules:

<FilesMatch "\.(bmp|class|doc|docx|eot|exe|ico|webp|json|mdb|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|pot|pps|ppt|pptx|svg|svgz|swf|tif|tiff|ttf|ttc|_ttf|wav|wri|woff|woff2|xla|xls|xlsx|xlt|xlw|BMP|CLASS|DOC|DOCX|EOT|EXE|ICO|WEBP|JSON|MDB|MPP|OTF|_OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|POT|PPS|PPT|PPTX|SVG|SVGZ|SWF|TIF|TIFF|TTF|TTC|_TTF|WAV|WRI|WOFF|WOFF2|XLA|XLS|XLSX|XLT|XLW)$">
    FileETag None
    <IfModule mod_headers.c>
         Header unset ETag
         Header unset Last-Modified
    </IfModule>
</FilesMatch>

What the code above does is for for the list of filetypes like bmp, doc, pdf and ico etc… is if the mod_headers.c Apache module is active it unsets the ETag and Last-Modified headers.

For a quick fix I manually modified the above rule, specifically deleting ico| and ICO| from the above rule. New code:

<FilesMatch "\.(bmp|class|doc|docx|eot|exe|webp|json|mdb|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|pot|pps|ppt|pptx|svg|svgz|swf|tif|tiff|ttf|ttc|_ttf|wav|wri|woff|woff2|xla|xls|xlsx|xlt|xlw|BMP|CLASS|DOC|DOCX|EOT|EXE|WEBP|JSON|MDB|MPP|OTF|_OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|POT|PPS|PPT|PPTX|SVG|SVGZ|SWF|TIF|TIFF|TTF|TTC|_TTF|WAV|WRI|WOFF|WOFF2|XLA|XLS|XLSX|XLT|XLW)$">
    FileETag None
    <IfModule mod_headers.c>
         Header unset ETag
         Header unset Last-Modified
    </IfModule>
</FilesMatch>

After uploading the .htaccess file GTMetrix no longer lists any cache validator issues.

A little annoying I had to manually edit the .htaccess rules, will have to look into this more deeply when I have the time to see if I can find a better solution which doesn’t require manual input.

Update October 2019: was getting a similar GTMetrix Specify a Cache Validator warning for a *.json file related to a Progressive Web Apps plugin I use, same issue as the favicon.ico file. W3 Total Cache is removing ETag & Last-Modified Headers for .json files.

Solution was like above, but delete the json| and JSON| code from the above .htacces rules

My new modified W3 Total Cache Version 0.10.1 .htaccess code below:

<FilesMatch "\.(bmp|class|doc|docx|eot|exe|mdb|webm|mpp|otf|_otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|pot|pps|ppt|pptx|svg|svgz|swf|tif|tiff|ttf|ttc|_ttf|wav|wri|woff|woff2|xla|xls|xlsx|xlt|xlw|BMP|CLASS|DOC|DOCX|EOT|EXE|MDB|WEBM|MPP|OTF|_OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|POT|PPS|PPT|PPTX|SVG|SVGZ|SWF|TIF|TIFF|TTF|TTC|_TTF|WAV|WRI|WOFF|WOFF2|XLA|XLS|XLSX|XLT|XLW)$">
    FileETag None
    <IfModule mod_headers.c>
         Header unset ETag
         Header unset Last-Modified
    </IfModule>
</FilesMatch>

I wonder why W3 Total Cache Plugin adds a cache etc for files like ico, json etc… then removes them?

David Law : Freelance SEO Expert

*
David Law : Technical SEO Expert with 20+ years Online Business, SEO, Search Engine Marketing and Social Media Marketing experience... Creator of multiple WordPress SEO Themes and SEO Plugins. Interests: wildlife, walking, environmental issues, politics, economics, journalism, consumer rights.

Website - SEO Gold Services