Reputation: 281
I am working on a website and I've got 1 php file which I want to cache longer than the rest (1 year instead of 15 min). For the general cache settings I used a .htaccess file but is it possible to do this in htacces? Or do I have to do it in a different way?
Upvotes: 1
Views: 466
Reputation: 7853
You could put this .htaccess in the directory where there is your PHP file, but others files in this directory will be affected.
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/x-javascript "access 1 year"
ExpiresDefault "access 1 year"
</IfModule>
## EXPIRES CACHING ##
This module controls the setting of the Expires HTTP header and the max-age directive of the Cache-Control HTTP header in server responses. The expiration date can set to be relative to either the time the source file was last modified, or to the time of the client access.
Depends on what you want to do. See here for more informations.
Upvotes: 1