Home:ALL Converter>Enable gzip compression

Enable gzip compression

Ask Time:2013-12-11T21:22:18         Author:user2045937

Json Formatter

My website running on Apache 2, modGzip and deflate enabled and working!

I add the following code on my htaccces file but if I check my page on gzip compression test. no Compression..

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

I searched alot and tried other mod or deflate codes but none of them work..what do I do to enable gzip compression?

Thanx alot!

Author:user2045937,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/20520314/enable-gzip-compression
Ryan :

For Apache\n\nYou will need to add the following lines to your .htaccess file:\n\n<IfModule mod_deflate.c>\n # Compress HTML, CSS, JavaScript, Text, XML and fonts\n AddOutputFilterByType DEFLATE application/javascript\n AddOutputFilterByType DEFLATE application/rss+xml\n AddOutputFilterByType DEFLATE application/vnd.ms-fontobject\n AddOutputFilterByType DEFLATE application/x-font\n AddOutputFilterByType DEFLATE application/x-font-opentype\n AddOutputFilterByType DEFLATE application/x-font-otf\n AddOutputFilterByType DEFLATE application/x-font-truetype\n AddOutputFilterByType DEFLATE application/x-font-ttf\n AddOutputFilterByType DEFLATE application/x-javascript\n AddOutputFilterByType DEFLATE application/xhtml+xml\n AddOutputFilterByType DEFLATE application/xml\n AddOutputFilterByType DEFLATE font/opentype\n AddOutputFilterByType DEFLATE font/otf\n AddOutputFilterByType DEFLATE font/ttf\n AddOutputFilterByType DEFLATE image/svg+xml\n AddOutputFilterByType DEFLATE image/x-icon\n AddOutputFilterByType DEFLATE text/css\n AddOutputFilterByType DEFLATE text/html\n AddOutputFilterByType DEFLATE text/javascript\n AddOutputFilterByType DEFLATE text/plain\n AddOutputFilterByType DEFLATE text/xml\n\n # Remove browser bugs (only needed for really old browsers)\n BrowserMatch ^Mozilla/4 gzip-only-text/html\n BrowserMatch ^Mozilla/4\\.0[678] no-gzip\n BrowserMatch \\bMSIE !no-gzip !gzip-only-text/html\n Header append Vary User-Agent\n<IfModule>\n\n\nAfter you've saved your .htaccess file, test your site to make sure it has been properly compressed.\n\nReference: http://websitespeedoptimizations.com/OptimizeGzipCompressionPost.aspx",
2016-01-24T16:23:57
Eric :

<IfModule mod_deflate.c>\nSetOutputFilter DEFLATE\nAddOutputFilterByType DEFLATE text/html text/css text/plain text/xml text/x-js text/js \n</IfModule>\n\n\nThat should do it. You'll want to clear you browser cache, refresh and retest in Google PageSpeed or YSlow to ensure you've gained some speed. \n\n(and you may need to add some of your own mime-types to the mix)\n\nEDIT: Here are the Apache docs on compression if that helps to customize/get this working. http://httpd.apache.org/docs/2.2/mod/mod_deflate.html\n\nEDIT 2: I would also check this answer out gzip working but YSlow indicates it's not",
2013-12-11T13:30:45
yy