Magento2 Leverage Browser Caching-The Performance’s Secret!

Updated 30 December 2020

Do you feel sluggish about your Magento2 store’s performance? You don’t have to worry, just enable Leverage Browser Caching and make your magento2 store incredibly fast with this Performance Secret.

Leverage Browser Caching

Leverage Browser Caching enables the website data to be stored on the user’s local browser. Which loads the website faster, when the user revisits the website.

How it works?

It works generally by specifying how long web browsers should keep images, CSS, and JS stored locally. Thus the user’s browser will download fewer data while navigating through your pages, which will improve your website’s loading speed.

Why We Termed It As a Performance’s Secret?

  • Because it reduces the web server’s load,
  • That eventually reduces your users’ loading time.

Implementation methods

Leverage Browser Caching in Apache

You can implement leverage browser cache for Apache servers by adding a small snippet to the .htaccess file. Mainly, There are two methods :

  1. mod_expires
  2. mod_headers
  1. mod_expires

First, sign in as the root user to access the server, then access the .htaccess file in the Magento root directory and /etc/apache2/apache.conf file, and then apply the following code:

After applying the code, enter the below command.

2. mod_headers

For this, apply the below code in the .htaccess file or in /etc/apache2/apache.conf file.

After applying the code, enter the below command.

Leverage Browser Caching in Nginx

Create a new configuration file, i.e. /etc/nginx/sites-available, in the website file folder. Then use the code below:

After this, restart the webserver to apply the settings.

Conclusion

Nothing in this world is perfect enough! Even without clouds, the sky’s incomplete. In the same way, to increase performance, Magento2 requires optimization. And Leverage Browser Cache is an essential factor in the phase of optimization.

If you want to optimize your Magento2 store by MySQL Query Cache. Just click to found something valuable.

Do you need optimization for your Magento2 store? Check us out.

Thanks For Reading!

In case of any help or query, please contact us or raise a ticket.

Category(s) ecommerce magento
author
. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project




    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home