mod_deflate in .htaccess and google pagespeed

Serjas picture Serjas · Aug 17, 2012 · Viewed 7.8k times · Source

i have a linode sever with centos 6 , as it wont support mod_gzip, i am using mod_deflate.

this is my code in .htacess

<IfModule mod_deflate.c>
  <FilesMatch "\\.(js|css|html|htm|php|xml)$">
    SetOutputFilter DEFLATE
  </FilesMatch>
</IfModule>

when i tested using http://www.whatsmyip.org/http-compression-test/ , its saying 'my site is gzipped' , but when i used pagespeed in chrome, it still suggest 'Enable compression'

whats wrong? any problem with my .htaccess code?

Answer

Ravi Makhija picture Ravi Makhija · Jul 13, 2018

I used deflate mode in this way:

<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 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
</IfModule>

And it's working perfectly for me. Pagespeed for my site is: Desktop: 91 Mobile: 83

References which I have used for my site:

  1. http://www.quickregisterseo.com/improve-google-page-speed-score-wordpress-without-plugins/
  2. https://dzone.com/articles/steps-improve-your-pagespeed-insight-score