Expirace cache

...

Moderátor: Mods_senior

Uživatelský avatar
Difadon
Level 2.5
Level 2.5
Příspěvky: 323
Registrován: leden 14
Bydliště: Špindlerův Mlýn
Pohlaví: Muž
Stav:
Offline
Kontakt:

Expirace cache

Příspěvekod Difadon » 29 led 2015 20:26

Ahoj,

Nedávno jsem zkoumal co vlastně znamená gzip komprese. Zjistil jsem, že je dobré ji mít aktivovanou pro zrychlení načítání. Zároveň jsem ale narazil na zajímavou úpravu .htaccess. Myslíte, že má smysl tu úpravu používat? Konkrétně se mi jedná o situaci použití na phpBB. Zkoušel jsem se zeptat na české podpoře, ale odpovědi jsem se nedočkal. :/

Kód: Vybrat vše

# ---------------------------------------------------------
# Proper MIME type for all files
# CZ: Normalizace MIME typu pro vsechny soubory
# ------------------------------------------------------------
 
# JavaScript
#   Normalize to standard type (it's sniffed in IE anyways)
#   tools.ietf.org/html/rfc4329#section-7.2
AddType application/javascript         js
 
# Audio
AddType audio/ogg                      oga ogg
AddType audio/mp4                      m4a
 
# Video
AddType video/ogg                      ogv
AddType video/mp4                      mp4 m4v
AddType video/webm                     webm
 
# SVG
#   Required for svg webfonts on iPad
#   twitter.com/FontSquirrel/status/14855840545
AddType     image/svg+xml              svg svgz
AddEncoding gzip                       svgz
 
# Webfonts
AddType application/vnd.ms-fontobject  eot
AddType application/x-font-ttf         ttf ttc
AddType font/opentype                  otf
AddType application/x-font-woff        woff
 
# Assorted types
AddType image/x-icon                        ico
AddType image/webp                          webp
AddType text/cache-manifest                 appcache manifest
AddType text/x-component                    htc
AddType application/x-chrome-extension      crx
AddType application/x-opera-extension       oex
AddType application/x-xpinstall             xpi
AddType application/octet-stream            safariextz
AddType application/x-web-app-manifest+json webapp
AddType text/x-vcard                        vcf
 
# ----------------------------------------------------------------
# Expires headers (for better cache control)
# CZ: Hlavicky pro kontrolu nastaveni expirace
# ----------------------------------------------------------------
 
# These are pretty far-future expires headers.
# They assume you control versioning with cachebusting
# CZ: Toto jsou hlavicky s velmi dlouhou dobou expirace
# CZ: Predpokladaji ze vyuzivate cachebusting techniku
 
# Additionally, consider that outdated proxies may miscache
# CZ: Nektere zastarale proxy mohou cachovat chybne
#   www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/
 
<IfModule mod_expires.c>
  ExpiresActive on
 
# Perhaps better to whitelist expires rules? Perhaps.
  ExpiresDefault                          "access plus 1 month"
 
# cache.appcache needs re-requests in FF 3.6 (thanks Remy ~Introducing HTML5)
  ExpiresByType text/cache-manifest       "access plus 0 seconds"
 
# Your document html
  ExpiresByType text/html                 "access plus 0 seconds"
 
# Data
  ExpiresByType text/xml                  "access plus 0 seconds"
  ExpiresByType application/xml           "access plus 0 seconds"
  ExpiresByType application/json          "access plus 0 seconds"
 
# Feed
  ExpiresByType application/rss+xml       "access plus 1 hour"
  ExpiresByType application/atom+xml      "access plus 1 hour"
 
# Favicon (cannot be renamed)
  ExpiresByType image/x-icon              "access plus 1 week"
 
# Media: images, video, audio
  ExpiresByType image/gif                 "access plus 1 month"
  ExpiresByType image/png                 "access plus 1 month"
  ExpiresByType image/jpg                 "access plus 1 month"
  ExpiresByType image/jpeg                "access plus 1 month"
  ExpiresByType video/ogg                 "access plus 1 month"
  ExpiresByType audio/ogg                 "access plus 1 month"
  ExpiresByType video/mp4                 "access plus 1 month"
  ExpiresByType video/webm                "access plus 1 month"
 
# HTC files  (css3pie)
  ExpiresByType text/x-component          "access plus 1 month"
 
# Webfonts
  ExpiresByType application/x-font-ttf    "access plus 1 month"
  ExpiresByType font/opentype             "access plus 1 month"
  ExpiresByType application/x-font-woff   "access plus 1 month"
  ExpiresByType image/svg+xml             "access plus 1 month"
  ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
 
# CSS and JavaScript
  ExpiresByType text/css                  "access plus 1 year"
  ExpiresByType application/javascript    "access plus 1 year"
 
</IfModule>
 
# ---------------------------------------------------------------
# ETag removal
# CZ: Odstraneni ETagu
# ---------------------------------------------------------------
 
# FileETag None is not enough for every server.
# FileETag None neni dostacujici pro vsechny servery.
 
<IfModule mod_headers.c>
  Header unset ETag
</IfModule>
 
# Since we're sending far-future expires, we don't need ETags for
# static content.
# CZ: Protoze nase expirace je daleko v budoucnu nepotrebujeme odesilat ETag pro staticky obsah.
# http://developer.yahoo.com/performance/rules.html#etags
 
FileETag None


A pokud to správně chápu, tak pokud upravím:

Kód: Vybrat vše

"access plus 1 month"


třeba na:

Kód: Vybrat vše

"access plus 2 month"


tak to znamená, že expiruje (tedy prohlížeč bude znovu stahovat data) až po 2 měsících?

Reklama

Zpět na “Vše ostatní (inet)”

Kdo je online

Uživatelé prohlížející si toto fórum: Žádní registrovaní uživatelé a 11 hostů