HTML (PHP) seems to have left the cache of the destination page, and even after updating the page, it behaves like it remains in the cache.The browser is Firefox.
What should I do to prevent pages from being cached?Also, is there any way to update and reflect the cached page?
First of all,
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-Control" content="no-cache">
<meta http-equiv="Expires" content="0">
I tried adding a meta like this, but it didn't work.It works well with Safari iPhone.If you know how to deal with it, could you tell me?
php firefox
How about this?
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Expires" content="<?php echo gmdate('D,dMY H:i:s').'GMT';?>"/>
<meta http-equiv="Last-Modified" content="<?php echo gmdate('D,dMY H:i:s').'GMT';?>"/gt;
For Expires
and Last-Modified
, specify a date instead of 0.
If you set the current time, it will always be treated as "expired" and will not be cached.
I checked just in case, but it didn't seem to be cached in the same way even if I put an invalid value as the date such as content="0" or content="-1" in Expires.
This is a user-facing operation, but each browser has what we call a super reload.
This is a reload method that ignores the cache on the page and requests all resources from the server.
FireFox official keyboard shortcut
Reload (cache overwrite)
The above items state that Ctrl+F5
and Ctrl+Shift+R
are possible.
The comment mentioned the setting of session.cache_limiter
, so I will add more.
In response, if you want to cut the cache, you must specify nocache
instead of public
.
You can also do this with a function of PHP
As the document states, this session.cache_limiter
affects the HTTP header of the response.
In order to solve this problem, I think it would be good to do the following:
If the above does not work, and only images, JS, and CSS are cached, check the reverse proxy server for images and CSS, JS cache mechanisms.(Like Akamai)
In that case,
<link rel="stylesheet" type="text/css" href="xxx.css?t=<?phpecho time();?>">
You can bypass the cache by adding query parameters after the filename as shown in .
© 2024 OneMinuteCode. All rights reserved.