Hetzner - DokuWiki

KonsoleH:Cache-Lebensdauer/en

How can the cache lifetime of the website be influenced?

The module mod_expires is installed on Apache for this purpose. This enables you to set the server side lifetime of the cache for your HTML pages, pictures etc.

  • ExpiresActive On
  • ExpiresDefault "access plus 30 seconds"

All files have a lifetime of 30 seconds. If the page is reloaded by the user after more than 30 seconds, it is fetched from the server and not from the cache of the browser. This can be defined even more precisely.

ExpiresActive on 
ExpiresDefault "now plus 1 hour" 
ExpiresByType image/gif "access plus 1 hour" 
ExpiresByType text/html "access plus 4 minutes" 
ExpiresByType text/plain "access plus 4 minutes"

Here different values for different files are specified. It is also possible for you to set cache liftime for one particular file only:

ExpiresActive on 
ExpiresByType image/gif "access plus 1 minutes"

These commands can be written in to your .htaccess file and then loaded into the public_html folder. The commands are activated immediately.



© 2018. Hetzner Online GmbH. Alle Rechte vorbehalten.