Enabling gzip compression in .htaccess file -


i trying enable gzip compression per google pagespeed suggestions how site load faster.

i have tried suggested addition .htaccess file found on https://varvy.com/pagespeed/enable-compression.html not work correctly.

my current .htaccess file contains following code. rewrite rule works correctly caching of various file types. not experienced in working .htaccess file, excuse me if have made obvious error. have tried reading around issue can't seem find answer need.

rewriteengine on rewritecond %{http_host} ^example.co.uk [nc] rewriterule ^(.*)$ http://www.example.co.uk/$1 [l,r=301]  ## expires caching ##  <ifmodule mod_expires.c>  expiresactive on  expiresbytype image/png "access 1 month"  expiresbytype text/css "access 1 month"  expiresbytype text/html "access 1 month"  expiresbytype text/x-javascript "access 1 month"  expiresbytype image/x-icon "access 1 month"  expiresbytype application/x-font-woff "access 1 month"  expiresdefault "access 1 month"  </ifmodule>  ## expires caching ##  <ifmodule mod_headers.c>   <filesmatch "\.(js|css|xml|gz|html|htm)$">     header append vary: accept-encoding   </filesmatch> </ifmodule>  <ifmodule mod_gzip.c>  mod_gzip_on yes  mod_gzip_dechunk yes  mod_gzip_item_include file .(html?|txt|css|js|php|pl)$  mod_gzip_item_include handler ^cgi-script$  mod_gzip_item_include mime ^text/.*  mod_gzip_item_include mime ^application/x-javascript.*  mod_gzip_item_exclude mime ^image/.*  mod_gzip_item_exclude rspheader ^content-encoding:.*gzip.*  </ifmodule> 

looks needed mod_deflate instead of mod_gzip.

added following .htaccess file , compresses files correctly:

 <filesmatch "\.(html?|txt|css|js|php|pl)$">     setoutputfilter deflate  </filesmatch> 

Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

Laravel mail error `Swift_TransportException in StreamBuffer.php line 269: Connection could not be established with host smtp.gmail.com [ #0]` -

c# SetCompatibleTextRenderingDefault must be called before the first -