Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
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. –  Waleed Hamra Mar 5 '12 at 20:25

2 Answers 2

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.