0

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

joeb
  • 777
  • 8
  • 28
  • what apache version you are using? – Ben Dec 07 '17 at 15:55
  • The version is Apache/2.4.25 – joeb Dec 07 '17 at 18:11
  • can you check if these modules are enabled? (mod_rewrite, mod_headers, mod_deflate, mod_setenvif, mod_filter) You should check in /etc/httpd/conf.modules.d/*.conf and see if these modules are loaded. – Ben Dec 07 '17 at 18:43
  • And you need to set the AllowOverride in /etc/httpd/conf/httpd.conf. If AllowOverride None, the .htaccess is completely ignored. – Ben Dec 07 '17 at 18:45
  • yes all modules are active and allowoverride is set to ALL – joeb Dec 07 '17 at 20:45

1 Answers1

0

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.

joeb
  • 777
  • 8
  • 28