I am developing a simple website using PHP.
Development Configuration : WAMP
Production Configuration : LAMP
While testing, I changed my CSS file, but when I reload the page my browser(not sure) still uses the old cached css.
I did some googling and found different solutions that I have already tried
- Appending a query at the end of css
Ctrl + R(in Firefox) to force fetching of the resource
- Disabling Firefox caching as well as using the
Clear CacheFirefox add-on.
When none of this worked, I did some more googling, where I came across a stack page (here) where someone suggested that Apache caches the resources. So, the problem is not with the Firefox, but the server. The guy also suggested a solution that I did not understand (me being a newbie)
My question has two parts:
- Is it true that Apache caches resources? (How do I check if mine does?)
- How to prevent it from caching?
PS: copying and pasting the solution in stack question (the one that I have above as a link) did not work :(
I've ran across this problem a few times and usually over come the problem on production sites by calling my css like this
When you roll out an update just change the
Googleyou will notice they use this approach as well.
v=2and it will force all of your users browsers to grab the new style sheets. This will work for script files as well. If you view source on