I have a script that is consumming too much resource to provide data that could be retrieved only each minute. Is there a way to configure Apache 2 through an .htaccess file to specify headers telling to the client to keep the script result as is for one minute in its cache ?
I know this could be done through the script itself, but I would like to do this through the webserver’s configuration.
mod_expires is the good solution.
If you are on a unix-like system :
Then you will be able to define the expiration conditions for a given file, or define the cache policy according to mimetype through your .htaccess file.
Here “A3600” means that the file expires 3600 seconds after access.
More information here : http://httpd.apache.org/docs/2.0/mod/mod_expires.html