After adding expires headers, you may found they are not working as expected. According to your server’s settings, there are a few situations that cause this issue.
In below checking process, assume you are using Apache server.
Checking flow of expires headers not working
- Check whether
.htaccess
is disabled inhttpd.conf
of your Apache (generallyhttpd.conf
is located in the/conf
folder).Check whether the
AllowOverride
option is set toNone
. If it is, then.htaccess
is disabled. You can add the configuration for adding expires headers in the main configuration filehttpd.conf
. -
Check whether
mod_expires
is loaded in yourhttpd.conf
.There will be a line like below if
mod_expires
is loaded inhttpd.conf
. If it is commented out or missed, fix it.LoadModule expires_module modules/mod_expires.so
-
Remember to restart Apache. Then you should find that the expires headers are working.