What is Gzip Compression ?
Gzip compression is a techniques/compression method to reduce the size of files like HTML,JS,CSS etc.By enabling Gzip compression on websites, you can increase the website speed very much.
How to enable Gzip compression on Websites
Gzip Compression can be enabled via your web server configuration
Gzip compression can also done from the cPanel it self.
To enable Gzip compression including .htaccess, Apache, Nginx web-servers use the codes given below.
Enable Gzip compression via .htaccess
Edit the .htaccess file and add the codes below.
< 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 # 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 >
To download above code as a file click here:
[wpdm_package id=’84’]
Download from here – Gzip Compression htaccess
Enable Gzip compression on Apache webservers
AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript
To download above code as a file click here:
[wpdm_package id=’88’]
Download from here – Gzip Compression Apache
Enable Gzip compression on on NGINX webservers
Add the following code to your configuration file on NGING:
gzip on; gzip_comp_level 2; gzip_http_version 1.0; gzip_proxied any; gzip_min_length 1100; gzip_buffers 16 8k; gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; # Disable for IE < 6 because there are some known problems gzip_disable "MSIE [1-6].(?!.*SV1)"; # Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6 gzip_vary on;
To download above code as a file click here:
[wpdm_package id=’86’]
Download from here – Gzip Compression NGINX
Now, Edit the configurations as per your web server, and refresh your home page to view the results.
Also, Leverage Browser Caching another mechanism to incerase the website performance.
To know more about leverage browser caching click here : Leverage Browser Caching