Fixing expires headers not working

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

  1. Check whether .htaccess is disabled in httpd.conf of your Apache (generally httpd.conf is located in the /conf folder).

    Check whether the AllowOverride option is set to None. If it is, then .htaccess is disabled. You can add the configuration for adding expires headers in the main configuration file httpd.conf.

  2. Check whether mod_expires is loaded in your httpd.conf.

    There will be a line like below if mod_expires is loaded in httpd.conf. If it is commented out or missed, fix it.

    LoadModule expires_module modules/mod_expires.so
    
  3. Remember to restart Apache. Then you should find that the expires headers are working.