I have updated some changes in my website but changes only displays when browser cache cleared, there are more than 2000 users use this website daily basis , how can i force cache cleared when they open website.
I have few example but I am not aware these will work or not like given below.
<?php
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>
AND
clearstatcache(); function
Where you have the css link just add a param to end of the url like this
The browser caches resources based on url and since we are changing the url by adding ?version=1 it will download the new css.
To avoid this issue in the future, when you deploy any css/js changes to production have a script that changes the name of the css file using this pattern style_timestamp.css style_1557467134.css