{"id":8487,"date":"2020-10-16T12:54:44","date_gmt":"2020-10-16T12:54:44","guid":{"rendered":"https:\/\/cloudkul.com\/blog\/?p=8487"},"modified":"2020-12-30T11:21:31","modified_gmt":"2020-12-30T11:21:31","slug":"leverage-browser-caching","status":"publish","type":"post","link":"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/","title":{"rendered":"Magento2 Leverage Browser Caching-The Performance&#8217;s  Secret!"},"content":{"rendered":"\n<p><strong>Do you feel sluggish about your Magento2 store&#8217;s performance?<\/strong> You don&#8217;t have to worry, just enable Leverage Browser Caching and make your magento2 store incredibly fast with this Performance Secret.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Leverage Browser Caching<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"859\" height=\"519\" src=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2020\/10\/lbc.png\" alt=\"\" class=\"wp-image-8488\"\/><\/figure>\n\n\n\n<p> Leverage Browser Caching enables the website data to be stored on the user&#8217;s local browser. Which loads the website faster, when the user revisits the website. <\/p>\n\n\n\n<p><strong>How it works?<\/strong><\/p>\n\n\n\n<p>It works generally by specifying how long web browsers should keep images, CSS, and JS stored locally. Thus the user\u2019s browser will download fewer data while navigating through your pages, which will improve your website\u2019s loading speed. <\/p>\n\n\n\n<p><strong>Why We Termed It As a Performance&#8217;s Secret?<\/strong><\/p>\n\n\n\n<ul><li>Because it reduces the web server&#8217;s load,<\/li><li>That eventually reduces your users&#8217; loading time.<\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Implementation <\/strong>methods<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Leverage Browser Caching in Apache<\/strong><\/h4>\n\n\n\n<p>You can implement leverage browser cache for Apache servers by adding a small snippet to the .htaccess file. Mainly, There are two methods :<\/p>\n\n\n\n<ol><li><strong>mod_expires<\/strong><\/li><li><strong>mod_headers<\/strong><\/li><\/ol>\n\n\n\n<ol><li><strong>mod_expires<\/strong><\/li><\/ol>\n\n\n\n<p>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:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;IfModule mod_expires.c>\nExpiresActive On\nExpiresByType image\/jpg \"access plus 1 year\"\nExpiresByType image\/jpeg \"access plus 1 year\"\nExpiresByType image\/gif \"access plus 1 year\"\nExpiresByType image\/png \"access plus 1 year\"\nExpiresByType text\/css \"access plus 1 month\"\nExpiresByType application\/pdf \"access plus 1 month\"\nExpiresByType text\/x-javascript \"access plus 1 month\"\nExpiresByType application\/x-shockwave-flash \"access plus 1 month\"\nExpiresByType image\/x-icon \"access plus 1 year\"\nExpiresDefault \"access plus 2 days\"\n&lt;\/IfModule><\/code><\/pre>\n\n\n\n<p>After applying the code, enter the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2enmod expires<\/code><\/pre>\n\n\n\n<p>2. <strong>mod_headers<\/strong><\/p>\n\n\n\n<p>For this, apply the below code in the .htaccess file or in \/etc\/apache2\/apache.conf file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;IfModule mod_headers.c>\n&lt;FilesMatch \"\\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$\">\nHeader set Expires \"day, dd month year hh:mm:ss GMT\"\nHeader set Cache-Control \"public\"\n&lt;\/FilesMatch>\n&lt;\/IfModule><\/code><\/pre>\n\n\n\n<p>After applying the code, enter the below command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>a2enmod headers<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Leverage Browser Caching in<\/strong> Nginx<\/h4>\n\n\n\n<p>Create&nbsp;a new configuration file, i.e. \/etc\/nginx\/sites-available, in the website file folder. Then use the code below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>location ~* \\.(jpg|jpeg|png|gif|ico|css|js)$ {\nexpires 365d;\n}\n\nlocation ~* \\.(pdf)$ {\nexpires 30d;\n}<\/code><\/pre>\n\n\n\n<p>After this, restart the webserver to apply the settings.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>Nothing in this world is perfect enough! Even without clouds, the sky\u2019s incomplete. In the same way, to increase performance, Magento2 requires optimization. And Leverage Browser Cache is an essential factor in the phase of optimization.<\/p>\n\n\n\n<p>If you want to optimize your Magento2 store by <strong>MySQL Query Cache<\/strong>.<a href=\"https:\/\/cloudkul.com\/blog\/magento2-mysql-query-cache\/\" target=\"_blank\" rel=\"noreferrer noopener\"><strong> Just click<\/strong><\/a> to found something valuable.<\/p>\n\n\n\n<p><strong>Do you need optimization for your Magento2 store? <a rel=\"noreferrer noopener\" href=\"https:\/\/store.webkul.com\/AWS-Speed-Security-Optimization-Magento-2.html\" target=\"_blank\">Check us out<\/a>.<\/strong><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Thanks For Reading!<\/strong><\/h2>\n\n\n\n<p><em><strong>In case of any help or query, please<\/strong>&nbsp;<a href=\"https:\/\/cloudkul.com\/contact\/\"><strong>contact<\/strong><\/a>&nbsp;<strong>us or raise a<\/strong>&nbsp;<strong><a href=\"https:\/\/webkul.uvdesk.com\/en\/customer\/create-ticket\/\">ticket<\/a>.<\/strong><\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Do you feel sluggish about your Magento2 store&#8217;s performance? You don&#8217;t have to worry, just <a class=\"text-primary\" title=\"read more\" href=\"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":31,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[87,20],"tags":[159,178,90,33,435,434,114,24,556],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Magento2 Leverage Browser Caching-The Performance&#039;s Secret! - Cloudkul<\/title>\n<meta name=\"description\" content=\"Leverage Browser Caching enable website data to be stored on the user&#039;s local browser. Which loads the website faster when the user revisits the website.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Magento2 Leverage Browser Caching-The Performance&#039;s Secret! - Cloudkul\" \/>\n<meta property=\"og:description\" content=\"Leverage Browser Caching enable website data to be stored on the user&#039;s local browser. Which loads the website faster when the user revisits the website.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/\" \/>\n<meta property=\"og:site_name\" content=\"Cloudkul\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-16T12:54:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-12-30T11:21:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2020\/10\/lbc.png\" \/>\n<meta name=\"author\" content=\"Bhawana Dehran\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/\",\"url\":\"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/\",\"name\":\"Magento2 Leverage Browser Caching-The Performance's Secret! - Cloudkul\",\"isPartOf\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/#website\"},\"datePublished\":\"2020-10-16T12:54:44+00:00\",\"dateModified\":\"2020-12-30T11:21:31+00:00\",\"author\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/1c8f54067c7f81f91da6df1534ce8d62\"},\"description\":\"Leverage Browser Caching enable website data to be stored on the user's local browser. Which loads the website faster when the user revisits the website.\",\"breadcrumb\":{\"@id\":\"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/cloudkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Magento2 Leverage Browser Caching-The Performance&#8217;s Secret!\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#website\",\"url\":\"https:\/\/cloudkul.com\/blog\/\",\"name\":\"Cloudkul\",\"description\":\"Host your eCommerce Store on AWS with Optimized Performance\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/cloudkul.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/1c8f54067c7f81f91da6df1534ce8d62\",\"name\":\"Bhawana Dehran\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5f035955c6c9130a5f553568a78b245c?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5f035955c6c9130a5f553568a78b245c?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g\",\"caption\":\"Bhawana Dehran\"},\"description\":\"Business Development Executive\",\"url\":\"https:\/\/cloudkul.com\/blog\/author\/bhawanadehran-bd033\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Magento2 Leverage Browser Caching-The Performance's Secret! - Cloudkul","description":"Leverage Browser Caching enable website data to be stored on the user's local browser. Which loads the website faster when the user revisits the website.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/","og_locale":"en_US","og_type":"article","og_title":"Magento2 Leverage Browser Caching-The Performance's Secret! - Cloudkul","og_description":"Leverage Browser Caching enable website data to be stored on the user's local browser. Which loads the website faster when the user revisits the website.","og_url":"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/","og_site_name":"Cloudkul","article_published_time":"2020-10-16T12:54:44+00:00","article_modified_time":"2020-12-30T11:21:31+00:00","og_image":[{"url":"https:\/\/cloudkul.com\/blog\/wp-content\/uploads\/2020\/10\/lbc.png"}],"author":"Bhawana Dehran","twitter_card":"summary_large_image","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/","url":"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/","name":"Magento2 Leverage Browser Caching-The Performance's Secret! - Cloudkul","isPartOf":{"@id":"https:\/\/cloudkul.com\/blog\/#website"},"datePublished":"2020-10-16T12:54:44+00:00","dateModified":"2020-12-30T11:21:31+00:00","author":{"@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/1c8f54067c7f81f91da6df1534ce8d62"},"description":"Leverage Browser Caching enable website data to be stored on the user's local browser. Which loads the website faster when the user revisits the website.","breadcrumb":{"@id":"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/cloudkul.com\/blog\/leverage-browser-caching\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/cloudkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Magento2 Leverage Browser Caching-The Performance&#8217;s Secret!"}]},{"@type":"WebSite","@id":"https:\/\/cloudkul.com\/blog\/#website","url":"https:\/\/cloudkul.com\/blog\/","name":"Cloudkul","description":"Host your eCommerce Store on AWS with Optimized Performance","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/cloudkul.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/1c8f54067c7f81f91da6df1534ce8d62","name":"Bhawana Dehran","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/cloudkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5f035955c6c9130a5f553568a78b245c?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5f035955c6c9130a5f553568a78b245c?s=96&d=https%3A%2F%2Fs.gravatar.com%2Favatar%2F6148c37469011bc2f8e491ca8f5de495%3Fs%3D80&r=g","caption":"Bhawana Dehran"},"description":"Business Development Executive","url":"https:\/\/cloudkul.com\/blog\/author\/bhawanadehran-bd033\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/8487"}],"collection":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/users\/31"}],"replies":[{"embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/comments?post=8487"}],"version-history":[{"count":13,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/8487\/revisions"}],"predecessor-version":[{"id":9295,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/posts\/8487\/revisions\/9295"}],"wp:attachment":[{"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/media?parent=8487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/categories?post=8487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cloudkul.com\/blog\/wp-json\/wp\/v2\/tags?post=8487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}