Search code examples
.htaccessapache2gziphttpd.confmod-deflate

Why Apache doesn't gzip css or js files which have parameters?


Some CSS & JS files are not compressed by apache with mod_deflate enabled. This files looks like this "[domain.name]/aggregator.css?..." or "[domain.name]/misc/jquery.js?..." in YSlow. The other CSS & JS without the "?" gets compressed. Kindly explain me how do I make apache compress this files also.

Thanks


Solution

  • There's nothing special about serving files with query strings, they should in general still be compressed (they are on my server).

    Unless there's something funny about the way you set up your OutputFilter? Let's see some httpd.conf. Where's the server?

    eta:

    <FilesMatch "\.(css|js|x?html?|php)$">
    

    Curious — works for me, unless there's something else broken in the config stopping it. It might be better to use the more usual:

    AddOutputFilterByType DEFLATE text/html text/css text/javascript text/xml text/plain
    

    though. (Then it will only try to deflate PHP scripts' output when they're those types and not, say, if you're spitting out an image.)