2

I've been trying to get this to work for hours now. The browser is downloading the file every time even though the Expires header is set to a week from now. Also tried on Firefox, same result. How can I specify that this resource is still valid and there's no need to download it every time?

Here is the Chrome network log

enter image description here

Here is the Chrome headers for the javascript file.

enter image description here

Here is my .htaccess code. I have confirmed that mod_expire is enabled.

ExpiresActive On

<FilesMatch "\.(css|js|gif|png|jpg|jpeg)$">
  ExpiresDefault "access plus 1 week"
  Header append Cache-Control "public"
</FilesMatch>
2
  • Did you check for the debug tools setting to disable cache when they are active ? Commented Mar 9, 2015 at 12:41
  • Yup checked them. Google fonts are being cached. Commented Mar 9, 2015 at 17:07

1 Answer 1

1

Change httpd.conf

<IfModule mod_expires.c>
          <FilesMatch "\.(jpe?g|png|gif|js|css)$">
                      ExpiresActive On
                      ExpiresDefault "access plus 1 year"
          </FilesMatch>
</IfModule>

Set cache to 2 years

Header set Cache-Control "max-age=63072000, public"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.