GZIP seems to compress only HTML, not CSS or JavaScript I'm not 100% sure this is a Craft specific problem, but I'll try here, as it relates to a Craft installation.

After running a number of tests, it seems that my CSS and JavaScript files are not getting GZIP-ed. I have a .htaccess file in my public folder, and no .htaccess files in the subfolders below. My CSS and JS files are stored in /assets/cssand /assets/js respectively (relative to the publicfolder).

My .htaccess file looks like this. Is there something I'm doing wrong? I thought the settings of the .htacces should work for subfolders when not overridden?

&lt;IfModule mod_rewrite.c&gt;
    RewriteEngine On
    RewriteBase /
    RewriteOptions InheritDown

    # Send would-be 404 requests to Craft
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
    RewriteRule (.+) index.php?p=$1 [QSA,L]
&lt;/IfModule&gt;

&lt;IfModule mod_deflate.c&gt;
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml
&lt;/IfModule&gt;
You can use .htaccess config from HTML Boilerplate for better configuration. There are a lot of useful config option there.

I use this config to enable gzip compression in my personal blog, and it's worked perfectly.

&lt;IfModule mod_deflate.c&gt;

    # Force compression for mangled `Accept-Encoding` request headers
    &lt;IfModule mod_setenvif.c&gt;
        &lt;IfModule mod_headers.c&gt;
            SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
            RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
        &lt;/IfModule&gt;
    &lt;/IfModule&gt;


    # Compress all output labeled with one of the following media types.
    &lt;IfModule mod_filter.c&gt;
        AddOutputFilterByType DEFLATE "application/atom+xml" \
                                      "application/javascript" \
                                      "application/json" \
                                      "application/ld+json" \
                                      "application/manifest+json" \
                                      "application/rdf+xml" \
                                      "application/rss+xml" \
                                      "application/schema+json" \
                                      "application/vnd.geo+json" \
                                      "application/vnd.ms-fontobject" \
                                      "application/x-font-ttf" \
                                      "application/x-javascript" \
                                      "application/x-web-app-manifest+json" \
                                      "application/xhtml+xml" \
                                      "application/xml" \
                                      "font/eot" \
                                      "font/opentype" \
                                      "image/bmp" \
                                      "image/svg+xml" \
                                      "image/vnd.microsoft.icon" \
                                      "image/x-icon" \
                                      "text/cache-manifest" \
                                      "text/css" \
                                      "text/html" \
                                      "text/javascript" \
                                      "text/plain" \
                                      "text/vcard" \
                                      "text/vnd.rim.location.xloc" \
                                      "text/vtt" \
                                      "text/x-component" \
                                      "text/x-cross-domain-policy" \
                                      "text/xml"

    &lt;/IfModule&gt;

    &lt;IfModule mod_mime.c&gt;
        AddEncoding gzip              svgz
    &lt;/IfModule&gt;

&lt;/IfModule&gt;