Ergebnis 1 bis 6 von 6

Thema: Caching / Bilder und fonts

  1. #1
    Contao-Fan
    Registriert seit
    28.02.2011.
    Beiträge
    680

    Standard Caching / Bilder und fonts

    Hallo,

    woran kann es liegen das google pagespeed insights trotz htaccess

    Code:
    <IfModule mod_expires.c>
    
      ExpiresActive on
    
      ExpiresDefault                                      "access plus 3 month"
    
      ExpiresByType audio/ogg                             "access plus 6 month"
      ExpiresByType image/bmp                             "access plus 6 month"
      ExpiresByType image/gif                             "access plus 6 month"
      ExpiresByType image/jpeg                            "access plus 6 month"
      ExpiresByType image/jpg                             "access plus 6 month"
      ExpiresByType image/png                             "access plus 6 month"
      ExpiresByType image/svg+xml                         "access plus 6 month"
      ExpiresByType image/webp                            "access plus 6 month"
      ExpiresByType video/mp4                             "access plus 6 month"
      ExpiresByType video/ogg                             "access plus 6 month"
      ExpiresByType video/webm                            "access plus 6 month"
    
    
      ExpiresByType application/vnd.ms-fontobject         "access plus 1 year"
      ExpiresByType fonts/eot                             "access plus 1 year"
      ExpiresByType fonts/opentype                        "access plus 1 year"
      ExpiresByType application/x-font-ttf                "access plus 1 year"                         
      ExpiresByType application/font-woff                 "access plus 1 year"
      ExpiresByType application/x-font-woff               "access plus 1 year"
      ExpiresByType fonts/woff                            "access plus 1 yearh"
      ExpiresByType application/font-woff2                "access plus 1 year"
      ExpiresByType application/x-font-woff2              "access plus 1 year"
      ExpiresByType fonts/woff2                           "access plus 1 year"  
    
    </IfModule>
    immer noch meckert
    "Statische Inhalte mit einer effizienten Cache-Richtlinie bereitstellen 18 Ressourcen gefunden"

    Oder ist mein htaccess falsch? Hab ich ehrlich gesagt aus dem web kopiert ...

    viele Grüße
    conter

  2. #2
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.095
    Partner-ID
    10107

    Standard

    Welche Ressourcen werden beanstandet, welche Cache Zeiten haben die im Response und welche Cache Zeiten schlägt Google vor?

  3. #3
    Contao-Fan
    Registriert seit
    28.02.2011.
    Beiträge
    680

    Standard

    Google listet in pagespeed insights
    webp Cache-TTL: none
    woff Cache-TTL: none

    wahrscheinlich ist meine expires Regel falsch

    Dies kriege ich im Terminal:
    Code:
    curl -I ....4c41eb12.webp
    HTTP/1.1 200 OK
    Date: Wed, 29 Jul 2020 08:17:14 GMT
    Server: Apache/2.4.29 (Ubuntu)
    Upgrade: h2
    Connection: Upgrade
    Content-Length: 188808
    Last-Modified: Tue, 28 Jul 2020 15:10:52 GMT
    Accept-Ranges: bytes
    Expires: Wed, 29 Jul 2020 08:20:00 GMT
    Etag: W/"PSA-V9p9LiNljD"
    Cache-Control: s-maxage=10
    X-Content-Type-Options: nosniff
    Content-Type: image/webp
    Code:
    $ curl -I http://####.de/files/###/fonts/myriadpro-semibold.woff
    HTTP/1.1 200 OK
    Date: Wed, 29 Jul 2020 08:20:29 GMT
    Server: Apache/2.4.29 (Ubuntu)
    Upgrade: h2
    Connection: Upgrade
    Last-Modified: Fri, 20 Mar 2020 12:59:18 GMT
    Accept-Ranges: bytes
    Content-Length: 62448
    Access-Control-Allow-Origin: *
    Content-Type: application/x-font-woff
    Geändert von conter (03.11.2020 um 11:06 Uhr)

  4. #4
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.095
    Partner-ID
    10107

    Standard

    Poste deine gesamte .htaccess

  5. #5
    Contao-Fan
    Registriert seit
    28.02.2011.
    Beiträge
    680

    Standard

    Code:
    <IfModule mod_headers.c>
        # Allow access from all domains for webfonts (see contao/core-bundle#528)
        <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2?|font\.css)$">
            Header set Access-Control-Allow-Origin "*"
        </FilesMatch>
    </IfModule>
    
    
    # Disable ETags
    
    FileETag None
    <IfModule mod_headers.c>
      Header unset ETag
    </IfModule>
    
    ##
    # Set the proper MIME types
    # @see https://github.com/h5bp/html5-boilerplate
    ##
    <IfModule mod_mime.c>
      AddType application/javascript              js jsonp
      AddType application/json                    json
      AddType audio/ogg                           oga ogg
      AddType audio/mp4                           m4a f4a f4b
      AddType video/ogg                           ogv
      AddType video/mp4                           mp4 m4v f4v f4p
      AddType video/webm                          webm
      AddType video/x-flv                         flv
      AddType image/svg+xml                       svg svgz
      AddEncoding gzip                            svgz
      AddType application/vnd.ms-fontobject       eot
      AddType application/x-font-ttf              ttf
      AddType application/x-font-ttc              ttc
      AddType font/opentype                       otf
      AddType application/x-font-woff             woff
      AddType application/x-font-woff2            woff2
      AddType image/x-icon                        ico
      AddType image/png                           png
      AddType image/jpg                           jpg
      AddType image/webp                          webp
      AddType text/cache-manifest                 appcache manifest
      AddType text/x-component                    htc
      AddType application/xml                     rss atom xml rdf
      AddType application/x-web-app-manifest+json webapp
      AddType text/x-vcard                        vcf
      AddType application/x-shockwave-flash       swf
    </IfModule>
    
    
    <IfModule mod_deflate.c>
      <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
        AddOutputFilterByType DEFLATE application/javascript
        AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
        AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
        AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
      </IfModule>
    </IfModule>
    
    
    AddEncoding gzip .gz
    <FilesMatch "\.js\.gz$">
    AddType "application/javascript" .gz
    </FilesMatch>
    <FilesMatch "\.css\.gz$">
    AddType "text/css" .gz
    </FilesMatch>
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME} \.(js|css)$
    RewriteCond %{REQUEST_FILENAME}.gz -f
    RewriteRule ^(.*)$ $1.gz [QSA,L]
    
    
    <IfModule mod_expires.c>
      ExpiresActive on
    
      ExpiresDefault                                      "access plus 3 month"
    
    # 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 week"
      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 6 month"
      ExpiresByType image/bmp                             "access plus 6 month"
      ExpiresByType image/gif                             "access plus 6 month"
      ExpiresByType image/jpeg                            "access plus 6 month"
      ExpiresByType image/jpg                             "access plus 6 month"
      ExpiresByType image/png                             "access plus 6 month"
      ExpiresByType image/svg+xml                         "access plus 6 month"
      ExpiresByType image/webp                            "access plus 6 month"
      ExpiresByType video/mp4                             "access plus 6 month"
      ExpiresByType video/ogg                             "access plus 6 month"
      ExpiresByType video/webm                            "access plus 6 month"
    
    
    # Web fonts
    
      # Embedded OpenType (EOT)
      ExpiresByType application/vnd.ms-fontobject         "access plus 1 year"
      ExpiresByType fonts/eot                             "access plus 1 year"
    
      # OpenType
      ExpiresByType fonts/opentype                        "access plus 1 year"
    
      # TrueType
      ExpiresByType application/x-font-ttf                "access plus 1 year"
                                                                      
      # Web Open Font Format (WOFF) 1.0                               
      ExpiresByType application/font-woff                 "access plus 1 year"
      ExpiresByType application/x-font-woff               "access plus 1 year"
      ExpiresByType fonts/woff                            "access plus 1 yearh"
    
      # Web Open Font Format (WOFF) 2.0
      ExpiresByType application/font-woff2                "access plus 1 year"
      ExpiresByType application/x-font-woff2              "access plus 1 year"
      ExpiresByType fonts/woff2                           "access plus 1 year"
      
    
    # Other
    
      ExpiresByType text/x-cross-domain-policy            "access plus 1 week"
      
    
    </IfModule>
    
    
    ##
    # Header adjustments
    ##
    <IfModule mod_headers.c>
    
      <FilesMatch "cron\.txt$">
        Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform"
      </FilesMatch>
    
    
    
      <FilesMatch "\.(js|css|xml|gz|svgz)$">
        Header append Vary Accept-Encoding
      </FilesMatch>
    
    
    
      <FilesMatch "\.map$">
        Header set Expires "0"
        Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform"
      </FilesMatch>
    
    </IfModule>
    
    
    <IfModule mod_rewrite.c>
        RewriteEngine On    
    
    
        RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
        RewriteRule ^(.*) - [E=BASE:%1]
    
        # Sets the HTTP_AUTHORIZATION header removed by Apache
        RewriteCond %{HTTP:Authorization} .
        RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
     
    
        #   following RewriteCond (best solution)
        RewriteCond %{ENV:REDIRECT_STATUS} ^$
        RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
    
        # If the requested filename exists, simply serve it.
        # We only want to let Apache serve files and not directories.
        RewriteCond %{REQUEST_FILENAME} -f
        RewriteRule ^ - [L]
    
        # Rewrite all other queries to the front controller.
        RewriteRule ^ %{ENV:BASE}/app.php [L]

  6. #6
    Contao-Fan
    Registriert seit
    28.02.2011.
    Beiträge
    680

    Standard

    ich hol das Thema noch mal nach oben.

    Sind die mod_expires Angaben so richtig?

    Viele Grüße,
    conter

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •