Reputation: 2141
I have a website with dynamic pages.
I want to set the cache for images (all my gif, jpg and png) and css files to a specified time (1 month)
I want the browser to confirm if the files are still same on the server before serving cache copy.
How can i go about it via PHP?
Upvotes: 2
Views: 384
Reputation: 6965
We do this at the web server level, apache in our case (this question is also tagged with apache
) using mod_expires.
You could do this with the following directives in your httpd.conf
, or similar:
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
Upvotes: 2