Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Problem ExpiresByType dla SCG oraz WOFF2
matti9410
post 16.04.2022, 15:27:38
Post #1





Grupa: Zarejestrowani
Postów: 70
Pomógł: 0
Dołączył: 10.07.2013

Ostrzeżenie: (0%)
-----


Cześć,
Poszukuję rozwiązania problemu dla mojej strony.
Używam PageSpeed Insights do sprawdzenia strony pod kątem Googla.
Jeden z problemów jest taki, że wypisuje mi "Wyświetlaj zasoby statyczne, stosując efektywne zasady pamięci podręcznej". W podglądzie wychodzi na to że nie mam ustawionego ExpiresByType dla SVG oraz WOFF2.


W pliku htaccess mam je natomiast ustawione.
Kod
# MIME TYPES
<IfModule mod_mime.c>
    
    # DEFAULTS
    DefaultLanguage en
    AddLanguage en-US .html .css .js
    AddCharset utf-8 .html .css .js .xml .json .rss .atom
    
    # JAVASCRIPT
    AddType application/javascript js jsonp
    AddType application/json json
    
    # FONTS
    AddType font/opentype otf
    AddType application/font-woff woff
    AddType application/font-woff2 woff2
    AddType application/x-font-woff woff
    AddType application/vnd.ms-fontobject eot
    AddType application/x-font-ttf ttc ttf
    AddType image/svg+xml svg svgz
    AddEncoding gzip svgz
    
    # AUDIO
    AddType audio/mp4 m4a f4a f4b
    AddType audio/ogg oga ogg
    
    # VIDEO
    AddType video/mp4 mp4 m4v f4v f4p
    AddType video/ogg ogv
    AddType video/webm webm
    AddType video/x-flv flv
    
    # OTHERS
    AddType application/octet-stream safariextz
    AddType application/x-chrome-extension crx
    AddType application/x-opera-extension oex
    AddType application/x-shockwave-flash swf
    AddType application/x-web-app-manifest+json webapp
    AddType application/x-xpinstall xpi
    AddType application/xml atom rdf rss xml
    AddType application/vnd.openxmlformats .docx .pptx .xlsx .xltx . xltm .dotx .potx .ppsx
    AddType text/cache-manifest appcache manifest
    AddType text/vtt vtt
    AddType text/x-component htc
    AddType text/x-vcard vcf
    AddType image/webp webp
    AddType image/x-icon ico
    
</IfModule>

## EXPIRES HEADER CACHING ##
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access 1 year"
    
  # CSS
    ExpiresByType text/css                              "access plus 1 year"

  # Data interchange
    ExpiresByType application/atom+xml                  "access plus 1 hour"
    ExpiresByType application/rdf+xml                   "access plus 1 hour"
    ExpiresByType application/rss+xml                   "access plus 1 hour"

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

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

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

  # JavaScript
    ExpiresByType application/javascript                "access plus 1 year"
    ExpiresByType application/x-javascript              "access plus 1 year"
    ExpiresByType text/javascript                       "access plus 1 year"

  # Manifest files
    ExpiresByType application/manifest+json             "access plus 1 year"

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

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

  # Web fonts

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

    # OpenType
    ExpiresByType font/opentype                         "access plus 1 month"

    # TrueType
    ExpiresByType application/x-font-ttf                "access plus 1 month"

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

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

  # Other
    ExpiresByType text/x-cross-domain-policy            "access plus 1 week"

</IfModule>
## EXPIRES HEADER CACHING ##
# END WordPress


Dodam, że dla innych typów czas ustawia się prawidłowo.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 27.04.2024 - 07:32