Have you ever tried sharing a huge number of files over the internet? If you had to upload each file, then Speed up your online store performance with various image optimization techniques with Magento 2 Page Speed Optimization Extension.
One of the most utilized e-commerce platforms worldwide is the Magento platform, and we can not ignore its performance optimization also. Success at Magento is of utmost importance.
What is Gzip?
Gzip is a file compression method that allows your server to provide smaller, faster-loading files to your website visitors. In most cases, using gzip to compress your HTML and CSS files saves between 50-70% of the file size.
How does Gzip Compression works in Magento 2?
The server is called to provide the requested files whenever a visitor visits the site. If files are larger in size, a higher load time will result. The bigger the file, the longer it takes to show the result.
The key reason is that it reduces the time it takes for a website to download page files and style sheets, which eventually reduces your website’s load time.
Benefits of Gzip Compression in Magento 2
- Generally, it reduces the time it takes for a website to download page files
- And reduces file size up to 70%
- In addition, it increases page speed
- As a result, enhances the server-side optimization
- It allows quick file transfer
- In enhancing the website performance
- In conclusion, it helps in improving SEO
How to enable Gzip Compression in Magento 2
There are many ways to enable gzip compression in Magento 2, we are using some of them here: –
Enable Gzip on Apache
One way to enable Gzip compression is to edit your .htaccess file. Apache is used by most shared hosts, where you can simply further add the code below to your .htaccess file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
<code><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></code> |
Enable Gzip on Nginx
To enable compression on Nginx, we can use the following code to watch your web server hit new speeds for page serving standards. Open the file/etc/nginx/nginx.conf.
Now add the following content: –
1 2 3 4 5 6 |
<code>gzip on; gzip_vary on; gzip_min_length 10240; gzip_proxied expired no-cache no-store private auth; gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml; gzip_disable "MSIE [1-6]\.";</code> |
Conclusion
Loading speed has a direct effect on your website’s conversion rate, as a result getting an optimized installation of Magento is vital to the success of your store and even your company in general.
Need Support?
Thank You for reading this Blog!
For further more interesting blogs, keep in touch with us. If you need any kind of support, simply raise a ticket at https://webkul.uvdesk.com/en/.
For further help or query, please contact us or raise a ticket.