• Resolved benoitroubert

    (@benoitroubert)


    Hello,

    Could it be possible to let the user decide to exclude some type of files like ICO / SVG / WOFF / WOFF2 from the list of type of files for which ETag and Last-Modified properties are unset in .htaccess like here:

    <FilesMatch "\.(bmp|class|doc|docx|eot|exe|ico|webp|json|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|ICO|WEBP|JSON|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>

    Because it lowers the score on GTMetrix for no real reason in our case for ICO / SVG / WOFF / WOFF2 files.

    • This topic was modified 5 years, 9 months ago by benoitroubert.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @benoitroubert,
    Thank you for your inquiry and I am happy to assist you with this.
    This is of course not recommended but you can add/edit .htaccess rules manually. Just replace the rule you provided with this one below:

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

    The rule provided does not contain ico|svg|woff|woff2|ICO|SVG|WOFF|WOFF2|
    However, this might require to change your .htaccess file permission to read only.
    I hope this helps

    Thread Starter benoitroubert

    (@benoitroubert)

    Hello @vmarko

    Indeed it works perfectly thank you!

    But since we need to force .htaccess to be in 444 (only read), each time we need to change some W3TC parameters, we will have to make it writable again, and these customization will be overwritten.

    Could this point be an option in W3TC parameters and allow us users, to choose if we want some kind of files to be excluded from this list?

    Thanks you in advance.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @benoitroubert,

    I am glad to know I could help.
    You should try to leave .htaccess permissions 644 and see how it behaves, I’ll present this to the team and I’ll notify you if there is something we can do abou this.

    Thread Starter benoitroubert

    (@benoitroubert)

    The problem is that if I let in 644, modification are overwritten each time I flush the cache.

    Thanks a lot for presenting this to your team and for the help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Last-Modified and ETag unset for ICO / SVG / WOFF / WOFF2…’ is closed to new replies.