Answers ( 5 )

  1. Understand what is leverage browser caching?

    When somebody visits a page, the browser needs to download all the resources on that page from the server. These include HTML, CSS file, JS, text, images, and any other assets in order to load and display the current page. Now, rather than actually downloading everything over and over again each time you visit a different page on the same site, the browser uses what is called a Web Cache. This is a feature used by browsers to ‘temporarily store’ or ‘cache’ web page assets on the device’s local storage. This storage or data is called ‘ Web Cache’ or ‘HTTP Cache‘. All speed optimization tools like Pagespeed insights, GTMetrix call it leverage browser caching if the cache is not enabled.

    How to Leverage Browser Caching?

    This can be done by adding some rules to your .htaccess file found in the root of your WordPress installation (hidden file). If you prefer, you can also do it with a plugin “Leverage Browser Caching WordPress Plugin“. An all in one caching plugin like WP Rocket has this feature integrated along with other speed optimization features. Learn More about WPRocket

  2. Fix Leverage Browser Caching WordPress:

    Caching should be a concern regardless of how many times people visit the site as that really doesn’t have any to do with it. You should have the option to leverage browser caching.

    Just about any caching plugin could take care of the stuff in your wp-content and wp-includes folders.

    You could grab a copy of the Google fonts, upload them to your server, and load them from there. Then your caching plugin would take care of them too. From my experience, that’s more likely to slow your website down than speed it up, however, since Google basically works like a CDN. Also, WP Rocket optimizes Google fonts, bundling them into one request.

    And it looks like you can do the same for Google Analytics. Just download it to your local and run it from there. I’m guessing you’ll want to update the script whenever Google does to make sure it works.

    I got very good Performance Results with the Caching Plugin WP-Rocket. Solves also the expires Headers Problem.

     

    Get WP Rocket

  3. What is the Leverage Browser Caching Warning?

    The leverage browser caching is referring to your browser cache. When you visit a website, The browser downloads HTML, CSS, JavaScript and images into browser’s local cache so that doesn’t have to download them again if you visit the page next time. But You Have To Enable Browser Cache Manually Or With A Plugin Like WP-Rocket

    How to Fix the Leverage Browser Caching Warning in WordPress?

    Use WP-Rocket Plugin To Fix Leverage Browser Caching Warning. You Can Also Get Rid Of WordPress Speed Issue Like Remove Query String From Static Resources

    Learn How To Speed Up WordPress Website

  4. How to Improve GTMetrix Score for a WordPress site:

    • Keep-alive is a server function, contact your hosting provider or transfer to another hosting to enable it.
    • Leverage browser caching is a default cache plugin function, but you can add your own rules to your .htaccess according to what GT Metrix suggests.
    • Combining images into CSS sprites is not a simple task. You combine all the small images into one large and then via CSS position property defines the locations of each small images and insert them into the right element.
    • Inline small CSS is pretty much self-explanatory, you gotta put small CSS coned inline instead of using an external sheet.
    • As for the Y slow score, you should add expires headers – this has a direct correlation with browser caching
    • Make fewer HTTP requests by combining them into fewer (can be turned on in WP Rocket configuration – not mandatory when using HHTP/2).
    • USE a CDN – I recommend Cloudflare
    • Reduce DNS lookups – you can add DNS records to prefetch in the preload section in your WP rocket configuration.

    But the most important thing (and I am really sorry to say so) your framework/theme is very slow and poorly optimized. The ultimate recommendation would be to try a new host and build your website with a better and more performance-oriented framework. Or you can use the plugin Asset cleanup to dequeue unnecessary scripts and js on a per post basis.

  5. Speed up WordPress Leveraging Browser Caching via .htaccess:

     

    # Enable Compression

    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

    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include mime ^application/x-javascript.*
    mod_gzip_item_exclude mime ^image/.*
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*

    # Leverage Browser Caching

    ExpiresActive On
    ExpiresByType image/jpg "access 1 year"
    ExpiresByType image/jpeg "access 1 year"
    ExpiresByType image/gif "access 1 year"
    ExpiresByType image/png "access 1 year"
    ExpiresByType text/css "access 1 month"
    ExpiresByType text/html "access 1 month"
    ExpiresByType application/pdf "access 1 month"
    ExpiresByType text/x-javascript "access 1 month"
    ExpiresByType application/x-shockwave-flash "access 1 month"
    ExpiresByType image/x-icon "access 1 year"
    ExpiresDefault "access 1 month"

    <filesmatch ".(ico|flv|jpg|jpeg|png|gif|css|swf)$">
    Header set Cache-Control "max-age=2678400, public"

    <filesmatch ".(html|htm)$">
    Header set Cache-Control "max-age=7200, private, must-revalidate"

    <filesmatch ".(pdf)$">
    Header set Cache-Control "max-age=86400, public"

    <filesmatch ".(js)$">
    Header set Cache-Control "max-age=2678400, private"

     

Leave an answer