The situation is as follows: there was a site www.mysite.com left a lot of different cookies, cached images and css styles. The site has been updated, but the cached information from users interferes with normal operation (especially google chrome 29). If you clear the history + cache + cookies, everything starts to work fine. Is it possible to force the browser to delete information on this site as it is forced upon the first entry, and then to cache it “as always”?

  • I read about it, in that case it will not be cached at all, but I would ideally like to “clean it off” and then cache it as always - ferrari
  • 2
    Go through the homes of your visitors and then clear their cache :) How do you imagine - all users will come to you at the same time during the period when your server will give these headers? Razkinte brains - "mark" peeled with cookies - the user came? Logged in Have a cookie? Not. Then get a cheder and put a new "marker" -kuku. Next time will go - check the "marker" -kuku. There is? Great - don't send more headers. Hold this for a while, until you feel that it is time to tie with this mechanism and everything has been "proapdate." - void
  • It really works! - ferrari
  • I would put the marker in the session, why is it in the cookie. - zb '

2 answers 2

Something like this:

<meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> 

Or send the header in the pages (somehow in this style)

 header('Expires: Sat, 03 Aug 2013 00:00:00 GMT'); header('Last-Modified: ' . gmdate( 'D, d MYH:i:s') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); header('Cache-Control: post-check=0, pre-check=0', false); header('Pragma: no-cache'); 

    For you, this is not a problem, so that css is displayed correctly on the site (as I understand it, you change it periodically and it breaks the site display) you just have to do a new css download address all the time like this:

     <link type="text/css" href="/css/css.css?<?php echo time();?>" rel="stylesheet"/> 

    and all the browser will think that the css file is new all the time and the layout will not break

    but I have another problem, the site has authorization and sometimes it happens that some pages (closed to non-authorized users) do not work, the fact is that the browser in these cases does not even try to check the authorization and immediately throws it back to the main page not an atorized user. And if you clear the browser cache, everything works right right away!

    I have already done a bunch of websites with authorization and have never met such a thing, what should I do? I'm just in shock.

    PS The browser does not allow cache in all ways: via php headers, via .htaccess and with the usual nocach meta tags

    • Here I wrote this message and it dawned on me! I understood my problem, it turned out that at the request of SEO-shnik, I changed all my redirects (which are sent to unauthorized users) to 301st. but this is a constant !!!! - Ilya
    • one
      If you have a question, ask it using the appropriate button. And to push the question into the answer is not necessary - andreymal