I'm using the code below in my .htaccess file to enable caching for my website:
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
</IfModule>
## EXPIRES CACHING ##
In that code, you can see that the cache expiration time is set as 1 year for some file types and 1 month for others. What I need is to make it expire after a single day. I have already tried to replace it by "1 day" and "24 hours", but neither of those work.
"1 day"
" - Was that literally"1 day"
or"access 1 day"
?"1 day"
is certainly an error as you are missing the base (ie.access
ormodification
) - this would have resulted in a 500 error. However,"access 1 day"
should work - theplus
keyword is optional.