.htaccessgzipmod-deflate

mod_deflate not working on all subdirectories


I'm trying to optimize a site for speed and I've enabled mod_deflate inside the htaccess file with the following snippet.

<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
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 application/css

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

# Remove browser bugs (only needed for really old browsers)
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent
</IfModule>

But when i run a speed test through gtmetrix, it's telling me that a few files are not gzipped yet.

http://example.com/themes/default/assets/js/jquery.themepunch.tools.min.js
http://example.com/themes/default/assets/js/jquery.js
http://example.com/themes/default/assets/js/jquery.themepunch.revolution.min.js
http://example.com/assets/js/bootstrap.min.js
http://example.com/assets/plugins/bootstrap-select/js/bootstrap-select.min.js
http://example.com/assets/plugins/bx-slider/jquery.bxslider.min.js
http://example.com/assets/plugins/bootstrap-touchspin/js/jquery.bootstrap-touchspin.min.js
http://example.com/assets/plugins/bootstrap-touchspin/css/jquery.bootstrap-touchspin.min.css
http://example.com/themes/default/assets/css/custom-2.css

I'm not too knowledgeable when it comes to mod_deflate. Is the section above where it says application a folder? And should I add a new section drilling down into the subfolders. It just seems the file could get rather large doing this


Solution

  • This turned out to be a problem with my server directly. Because my server used nginx, all the cache commands needed to be set inside the nginx config file.