A
A
Alexander92922020-11-03 16:01:23
css
Alexander9292, 2020-11-03 16:01:23

Google Page Speed ​​- fonts, icons, js and css file not cached?

I set caching on the site, after which about 40 resources are cached, and 26 still remain in non-cache.
Why woff2 fonts, svg and png icons, js and css file are not cached by Google Page Speed ​​analysis?
5fa153e3425b8911159338.png

Cache code I'm using:

<IfModule mod_expires.c>

    ExpiresActive on
    ExpiresDefault                                      "access plus 31536000 seconds"

  # CSS
    ExpiresByType text/css                              "access plus 7 days"

  # Data interchange
    ExpiresByType application/atom+xml                  "access plus 31536000 seconds"
    ExpiresByType application/rdf+xml                   "access plus 31536000 seconds"
    ExpiresByType application/rss+xml                   "access plus 31536000 seconds"

    ExpiresByType application/json                      "access plus 31536000 seconds"
    ExpiresByType application/ld+json                   "access plus 31536000 seconds"
    ExpiresByType application/schema+json               "access plus 31536000 seconds"
    ExpiresByType application/vnd.geo+json              "access plus 31536000 seconds"
    ExpiresByType application/xml                       "access plus 31536000 seconds"
    ExpiresByType text/xml                              "access plus 31536000 seconds"

  # Favicon (cannot be renamed!) and cursor images
    ExpiresByType image/vnd.microsoft.icon              "access plus 31536000 seconds"
    ExpiresByType image/x-icon                          "access plus 31536000 seconds"

  # HTML
    ExpiresByType text/html                             "access plus 31536000 seconds"

  # JavaScript
    ExpiresByType application/javascript                "access plus 7 days"
    ExpiresByType application/x-javascript              "access plus 7 days"
    ExpiresByType text/javascript                       "access plus 7 days"

  # Manifest files
    ExpiresByType application/manifest+json             "access plus 31536000 seconds"

    ExpiresByType application/x-web-app-manifest+json   "access plus 31536000 seconds"
    ExpiresByType text/cache-manifest                   "access plus 31536000 seconds"

  # Media files
    ExpiresByType audio/ogg                             "access plus 31536000 seconds"
    ExpiresByType image/bmp                             "access plus 31536000 seconds"
    ExpiresByType image/gif                             "access plus 31536000 seconds"
    ExpiresByType image/jpeg                            "access plus 31536000 seconds"
    ExpiresByType image/jpg                             "access plus 31536000 seconds"
    ExpiresByType image/png                             "access plus 31536000 seconds"
    ExpiresByType image/svg+xml                         "access plus 31536000 seconds"
    ExpiresByType image/webp                            "access plus 31536000 seconds"
    ExpiresByType video/mp4                             "access plus 31536000 seconds"
    ExpiresByType video/ogg                             "access plus 31536000 seconds"
    ExpiresByType video/webm                            "access plus 31536000 seconds"

  # Web fonts

    # Embedded OpenType (EOT)
    ExpiresByType application/vnd.ms-fontobject         "access plus 31536000 seconds"
    ExpiresByType font/eot                              "access plus 31536000 seconds"

    # OpenType
    ExpiresByType font/opentype                         "access plus 31536000 seconds"

    # TrueType
    ExpiresByType application/x-font-ttf                "access plus 31536000 seconds"

    # Web Open Font Format (WOFF) 1.0
    ExpiresByType application/font-woff                 "access plus 31536000 seconds"
    ExpiresByType application/x-font-woff               "access plus 31536000 seconds"
    ExpiresByType font/woff                             "access plus 31536000 seconds"

    # Web Open Font Format (WOFF) 2.0
    ExpiresByType application/font-woff2                "access plus 31536000 seconds"

  # Other
    ExpiresByType text/x-cross-domain-policy            "access plus 31536000 seconds"

</IfModule>

<FilesMatch "\.(ogg|ogv|svg|css|js|svgz|eot|otf|woff|woff2|mp4|ttf|rss|atom|jpg|jpeg|gif|png|webp|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$">
    Header set Cache-Control "max-age=31536000, must-revalidate"
</FilesMatch>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2020-11-03
Websaytovsky @ws17

Good question, I'm also interested in this right now, I'm adapting the site so that it loads faster.
I have svg and woff2 like this
# Add correct content-type for fonts & SVG
AddType application/font-woff2 .woff2
AddType image/svg+xml .svg
and

<ifModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript application/font-woff2 image/svg+xml
</ifModule>

I tried your code and then scanned the site again, as it was 39, it remains.
Set cache efficiency rules for static objects Found 39 resources.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question