GZIP compression improves the performance of your website and decreases its loading time. When a visitor makes a request for your website, the server compresses the requested page, significantly reducing its size, and transfers it to the customer\'s computer. On the visitor\'s end the file is being decompressed and visualized. The time needed for file compression is much less than the time to transfer a big file over the Internet, thus compression enhances the performance of a website.
To enable GZIP compression for your text, html, JavaScript, CSS and XML you can add these lines inside the your website\'s .htaccess file:
1 2 3 4 5 6 7 8 9 10 11 | <IfModule mod_deflate.c> 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 </IfModule> |
You can edit the .htaccess file with the File Manager in cPanel or via FTP.
Note that compression is disabled by default for joomla site Staging instances. This means that the above .htaccess rules will have no effect and the compression will function as expected after the website is pushed live.
Note also that compression on server side will not work for remote resources that are loaded on the web page(such as remote CSS or Java Script inclusion for example). This is important as third party test tools(like GTMetrix) might not properly detect GZip compression as enabled.
Some applications also have internal support to compress their pages. For example, in Joomla you can turn on the Gzip compression from Global Configuration -> Server -> Gzip Page Compression set to Yes.
You find this article useful? Click here to learn more about joombig template and extension experts and what else we can do for you!
Related Article
destination source:https://www.siteground.com/kb/how_to_enable_gzip_compression_for_your_pages/