How To Enable GZIP Compression for Magento

GZIP compression is a standard method to compress files for faster webpage loading.

When a visitor visits the site, the server is called to deliver the requested files. If these files are larger in the size, it causes a higher load time.

Bigger the file, longer it takes to display the result to the visitor.

With GZIP compression, the files are compressed before sending them to the browser, resulting in reducing the load time.

According to GTmetrix, GZIP compression reduces the size of pages and style sheets by up to 70%! And thus, optimizing your webpages by enabling GZIP compression should be your priority if you want to outrank the competitors and offer a smooth user experience. And for Magento 2 and Magento stores, it is not an option to ignore performance optimization.

Ecommerce platform must be optimized for quick shopping owing to the cutthroat competition. And as a store owner, you can just start with the below method to enable GZIP compression for Magento stores!

Method To Enable GZIP Compression for Magento:

Make sure mod_deflate is on in Apache. You can check by creating an info.php file and calling phpinfo();. It will output server PHP / Apache specs in the browser. Don’t forget to remove it when you’re done!

Then add the following to your htaccess file

That’s it.

If you are looking for other ways to optimize the Magento 2 store performance, follow the checklist at How do I Speed Up Magento 2

Please mention any doubts on the topic in the Comments section below. I’d be happy to help.

Boost the Magento 2 store speed and enjoy the top rank because site speed is surely one of the important factors to decide the same for the search engines!

You may share this post on social media to help the community optimize their Magento 2 stores!



(based on 14 Reviews)
How To Enable GZIP Compression for MagentoAuthor Magento Badge

Sanjay Jethva

Sanjay is a co-founder at Meetanshi. He is a Certified Magento Developer who loves creating Magento E-commerce solutions. Owing to his contributions in Magento Forums and posting solutions, he is among the top 50 contributors of the Magento community in 2019. When he is not engrossed with anything related to Magento, he loves to play cricket.


Leave a Reply

Your email address will not be published.