Enable Gzip Compression

This section is related to the article, Leverage Browser Caching, so be sure to read that first.

In addition to the codes to leverage browser caching, the Optimize .htaccess button also adds codes to the .htaccess file at the root of your site to compress static files using gzip. The gzip codes will look like this:

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/font
AddOutputFilterByType DEFLATE application/font-truetype
AddOutputFilterByType DEFLATE application/font-ttf
AddOutputFilterByType DEFLATE application/font-otf
AddOutputFilterByType DEFLATE application/font-opentype
AddOutputFilterByType DEFLATE application/font-woff
AddOutputFilterByType DEFLATE application/font-woff2
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/woff
AddOutputFilterByType DEFLATE font/woff2
# For Olders Browsers Which Can't Handle Compression
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</IfModule>
						
				

As in the case for leverage browser caching, these codes don't affect files loaded dynamically from external servers. If you're seeing local static files being loaded that are not compressed, check with your host to see if mod_deflate is installed and enabled on the server.

If the static files that require compression are the combined css or js files generated by the plugin, you can select another option for the Combine files delivery setting in the Combine CSS and javascript files feature on the Basic Options tab. The settings other than Static CSS and js files uses PHP files to deliver the combined css or js file and they will be gzip compressed using PHP for all automatic settings above Basic.