What is Gzip compression ?
Gzip compression is a method of compressing files (making them smaller) for faster network transfers of file to load. It is also a file format. Gzip Compression allows your web server to provide smaller file sizes which makes your website to load faster for your website users and visitors.If you are not using it for some reason, your webpages are likely slower than your competitors.
- Here are the most common ways to enable compression including .htaccess, Apache, Nginx and litespeed Webservers
Enable compression via .htaccess
- Login into your cpanel
- Open to File Manager
- Go to path “public_html/www”
- The code below should be added to your .htaccess file
# START GZIP COMPRESSION
Header append Vary User-Agent env=!dont-vary
# DEFLATE by extension
AddOutputFilter DEFLATE js css htm html xml
# END GZIP COMPRESSION
Enable compression on Apache webservers
These instructions and code above will work on Apache. If they are not working there is another way that may work for you. If the above code did not seem to work, remove it from your .htaccess file and try this one instead
# START 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
# END GZIP COMPRESSION on Apache webservers
Enable compression on NGINX webservers
To enable compression in NGINX you need to paste the following code to your config file
# START GZIP COMPRESSION on NGINX webservers
gzip_buffers 16 8k;
# 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
# END GZIP COMPRESSION on NGINX webservers
Enable compression on Litespeed web-servers
- The ideal way to enable compression in Litespeed is to do it through the configuration under “tuning”.
- Just go down to “enable compression” and check to see if it is on, if not click “edit” then choose to turn it on.
- While you are there, look over the several Gzip options that are nearby.
Thank you i hope it useful to you.