Cache lifetime

How can I set the cache lifetime for a website?

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 browser's cache. You can define this 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, you can set different values for different files. It is also possible for you to set a cache liftime for only one particular file:

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

You can write these commands in your .htaccess file and then load that into the public_html folder. The commands will be active immediately.

  • 0 Kasutajad peavad seda kasulikuks
Kas see vastus oli kasulik?

Seotud artiklid

CGI scripts

Using CGI scripts File your CGI scripts in the "public_html" folder of your account. Make sure...

Content compression

Activate compression mod_deflate (for Gzip) is installed on our servers. You can activate it by...

CORS

Cross-origin resource sharing (CORS) is a mechanism that allows web applications to access...

Directory index

How can I protect a folder from being viewed in the browser? In the menu, go to "Manage...

Duplicate password request

Why does password protection always ask for access data twice? You can avoid this by adding / at...

Powered by WHMCompleteSolution