[Plugin: W3 Total Cache] How to enable gzip of stylesheets (and javascript) with query string ?ver= (6 posts)

  1. chrishajer
    Posted 6 years ago #

    Hi. Many of the stylesheets and JavaScript files on my site are now gzipped, but a couple are still being reported by YSlow as not being gzipped. It looks like that is due to the file having a ?ver=123456789 query string appended to the filename. Here's an example:

    that is the style.css filemtime

    that is the WordPress version

    Any idea how to enable gzip for those CSS files? I have a JavaScript file that is showing up as not gzipped for the same reason, I believe.

    Thank you.


  2. Frederick Townes
    Posted 6 years ago #

    Add the full URI of those files with query strings to minify and all will be taken care of for you. YSlow is not perfect and does give false positives across a number of issues.

    The FAQ in the plugin contains a number of recommended tools to check the http compression of files.

  3. chrishajer
    Posted 6 years ago #

    Thank you sir.

  4. Frederick Townes
    Posted 6 years ago #

    You're welcome.

  5. chrishajer
    Posted 6 years ago #

    Hello again Frederick. I added the strings (turned out to be one JS and one CSS) to the minify admin page, but if I understand correctly, minify and gzip are two different things, right? So, maybe it's more of an Apache configuration thing to get gzip working on ASCII files that don't match a regex of .css or .js (i.e. a query string version as I mentioned.) Normally I would do this in the .htaccess file, but since this is all in the plugin (the gzip portion) is there a way to make this happen (gzip compression, not minify)?

    Also, maybe it's just a false positive from YSlow? Since all these that were not gzipped had a query string after the filename, and the ones that were without a query string did get gzipped, I assumed that YSlow is probably correct. I recall reading in the FAQ about a wget or curl command to test for compression on individual files. I will check that again.

    I think I'm probably using query string incorrectly here, but I mean the part after the .js or .css, in my case ?ver=1234567890.

  6. Frederick Townes
    Posted 6 years ago #

    In the latest version of the plugin I try to make sure that apache cannot interfere with the compression.

    You should not have to do anything special for compression to be working and in apache 2 I know for certain that any of your mod_deflate settings do not effect minify's attempts to gzip.

    Yes SLow does give some false positives for various metrics. Try Google Page Speed. You can also check a http compression checker site as well.

Topic Closed

This topic has been closed to new replies.

About this Topic