: How to set browser cache to expire after one day? I'm using the code below in my .htaccess file to enable caching for my website: ## EXPIRES CACHING ## <IfModule mod_expires.c> ExpiresActive
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.
More posts by @Si4351233
1 Comments
Sorted by latest first Latest Oldest Best
It might be as simple as missing one keyword that is causing your issue.
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 day"
ExpiresByType image/jpeg "access plus 1 day"
ExpiresByType image/gif "access plus 1 day"
ExpiresByType image/png "access plus 1 day"
ExpiresByType text/css "access plus 1 day"
ExpiresByType application/pdf "access plus 1 day"
ExpiresByType text/x-javascript "access plus 1 day"
ExpiresByType application/x-shockwave-flash "access plus 1 day"
ExpiresByType image/x-icon "access plus 1 day"
ExpiresDefault "access plus 1 day"
</IfModule>
## EXPIRES CACHING ##
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.