In order for the site to work as efficiently as possible, it is advisable to set the caching time for various file types for the maximum possible period. There is an Apache mod expires module for this.

The parameters of the mod_expires module are configured in the .htaccess file, which allows you to make individual settings for each directory.

In the example below, caching is disabled for text documents, the update period for files with the gif extension is set to 3 months from the moment the file was changed, for files with the jpeg extension to 1 day from the moment of access:

ExpiresActive on
ExpiresByType image/jpeg "access plus 1 day"
ExpiresByType image/gif "modification plus 3 months"
ExpiresByType text/html "now"
Was this answer helpful? 52 Users Found This Useful (200 Votes)