I am developing a simple website using PHP.
Development Configuration : WAMP
Production Configuration : LAMP
While
I always using httcacheclean
when change something in asset files (js, css, etc)
Anyhow I'm not getting the point in that. For development it's way easier to just disable your browsercache or hit Ctrl + r.
In my php pages i usually add the current date time to the end of your css href:
<link rel="stylesheet" type="text/css" href="style.css?<?php echo date('l jS \of F Y h:i:s A'); ?>" />
Ref : Here
I know this is an old question, but I just came across this and had some of the same issues. Here is a quick way to not keep cache on any file:
<link rel="stylesheet" href="css/style.css?<?=time()?>">
Using the helps get the newest version each time the page is loaded.
I used to have the same problem with my LAMP dev system, caused by a network mount. I managed to get rid of it by adding these two lines to my apache conf.
EnableMMAP off
EnableSendfile off
I've ran across this problem a few times and usually over come the problem on production sites by calling my css like this
<link rel="stylesheet" type="text/css" href="style.css?v=1" />
When you roll out an update just change the v=1
to v=2
and 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 Google
you will notice they use this approach as well.