I've been rather perplexed by this and was hoping someone might be able to shed some light.
In my htaccess file, I have:
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType text/html "access plus 4 hours"
</IfModule>
However, it doesnt seem to be working when I check the headers.
I get "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
But if I use THIS code:
# 4 HOURS
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=14400, must-revalidate"
</FilesMatch>
It DOES pick up the cache. max-age=14400, must-revalidate
Am I missing something? Is one for the server and one for the browser? I mean, I'd prefer to use the first since it came with boilerplate if they are both the same.
Thanks in advance!
I don't know if you already have the solution but are you sure mod_expire is enabled on your server? On ubuntu
sudo apache2ctl -M
.You can also try to comment out
<IfModule mod_expires.c>
and</IfModule>
and restart apache. It will crash ifmod_expires
is not enabled.To enable mod_expire:
mod_expires will create the
Expire
header and should modify themax-age=14400
part of theCache-Control
header only. For themust-revalidate
part you will have to useHeader
.