1

After modifying a CSS file on my Apache server the browser does not seem to load the latest one until I hit Refresh on my browser. Opening the page normally by clicking the link or pressing enter in the address bar does not pull the updated CSS file. It is OK to refresh when developing, but this is a live server.

The HTML file that includes CSS has cache-control set to no-cache and the Apache server has default config.

Any pointers? Thank you

1
  • 3
    it could be an ISP cache, or just firefox hiccuping. to make sure, if you have a *nix environment available, or you can get the win32 wget.exe, use it to download the css, but use the "--debug" switch to see who's doing the caching. if wget always pull updated files, then it's firefox's fault. Mar 5, 2012 at 20:25

2 Answers 2

1

you can try to add this to your Apache config file :

<IfModule mod_headers.c>
<filesMatch "\\.(html|htm|css)$">
Header set Cache-Control: "no-cache, must-revalidate"
</FilesMatch>
</IfModule>

Note that you need to enable the mod_headers.

0

Caching for the CSS is usually controlled by the Cache-Control header on the CSS file, not the HTML file. That's how you'd tell the browser to cache all your styling, but not the data, which sounds like what is happening here.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .