Page Speed Insights – Serve static assets with an efficient cache policy

  • Author
    Posts
  • #84619

    diamondrcreative
    Power User

    My website – https://diamondrcreative.com – is using Anima Plus and getting warning from PageSpeed Insights regarding Leveraging Browser Cache – Serve static assets with an efficient cache policy

    https://diamondrcreative.com/wp-content/themes/anima-plus/resources/fonts/socials.woff
    https://diamondrcreative.com/wp-content/themes/anima-plus/resources/fonts/blocks.woff
    https://diamondrcreative.com/wp-content/themes/anima-plus/resources/fonts/iconmeta.ttf

    I’ve tried different variations listed below but no luck. I’ve tried the following the htaccess – are they incorrect, wrong, or useless? LMK
    Also LMK if there’s a correct addition to htaccess to correct these, please.

    AddType font/woff .woff
    AddType font/woff2 .woff2
    AddType application/x-font-ttf .ttf
    AddType application/x-font-opentype .otf
    AddType application/x-font-woff .woff
    AddType application/x-font-woff2 .woff2
    AddType image/svg+xml .svg
    AddType application/font-sfnt .otf .ttf
    AddType application/font-woff .woff
    AddType application/font-woff2 .woff2
    AddType application/vnd.ms-fontobject .eot

    ExpiresByType application/vnd.ms-fontobject “access plus 1 year”
    ExpiresByType application/x-font-ttf “access plus 1 year”
    ExpiresByType application/x-font-opentype “access plus 1 year”
    ExpiresByType application/x-font-woff “access plus 1 year”
    ExpiresByType application/x-font-woff2 “access plus 6 month”
    ExpiresByType application/font-woff “access plus 1 year”
    ExpiresByType application/font-woff2 “access plus 6 month”
    ExpiresByType application/font-sfnt “access plus 1 year”
    ExpiresByType font/ttf “access plus 1 year”
    ExpiresByType font/otf “access plus 1 year”
    ExpiresByType font/woff “access plus 1 year”
    ExpiresByType font/woff2 “access plus 1 year”

    Any help would be sincerely appreciated – thank you.

    Website: diamondrcreative.com

    #84666

    Zed
    Cryout Creations Team

    As described in this GTmetrix article (which you most likely already read), browser caching can be enabled with specific configuration rules at the server level (because the webserver needs to pass along specific headers to the browser).

    The article describes some rules for the Apache web server (which require the specific mod_expire module to be enabled on the server hosting your site). Other web servers may use a different configuration – I suggest to contact your hosting provider for more information on what server software they use and what configuration changes are allowed.


    If you like our creations, help us share by rating them on WordPress.org.
    Please read the available documentation and search the forums before posting.
    #84678

    Is your server NGINX? If so you can use this code snippet:

    # browser caching of static assets
    location ~*  \.(jpg|jpeg|png|gif|ico|css|js|pdf)$ {
        expires 7d;
    }

    which was taken from this guide: Serve Static Assets With An Efficient Cache Policy guide

    Website: pagespeedplus.com

    #84831

    diamondrcreative
    Power User

    Thanks leaderint! Like your website!

    No, it is Apache. Still haven’t found a solution but do appreciate your effort. 🙂

    Website: diamondrcreative.com

    #84859

    Zed
    Cryout Creations Team

    I answered in the other topic:

    GT Metrix – Specify a cache validator


    If you like our creations, help us share by rating them on WordPress.org.
    Please read the available documentation and search the forums before posting.
Viewing 5 posts - 1 through 5 (of 5 total)

You need to log in to reply to this topic.