您可能需要在主模板标头中设置nocache标头。将其包含在标题顶部附近。开始标记后的php:nocache_headers()
从这里开始:Function Reference/nocache headers
运行一些测试,我认为这只会影响主页文件,其他文件仍应正常缓存。
更理想的是,wordpress应该在主页上发送最后修改的标题。等一下,我再深入研究一下。
请注意缓存控件的最大年龄。如您所见,缓存已设置为30天。这意味着浏览器将假定30天内没有任何更改,除非服务器发送不同的标头。
HTTP/1.1 200 OK
X-Powered-By: PHP/5.4.45
Cache-Control: public, max-age=2592000
Expires: Wed, 22 Mar 2017 01:15:09 GMT
Content-Type: text/html; charset=UTF-8
Link: <http://zilredloh.com/wp-json/>; rel="https://api.w.org/"
Link: <http://wp.me/1ZLfW>; rel=shortlink
Vary: Accept-Encoding
Date: Mon, 20 Feb 2017 01:15:09 GMT
Accept-Ranges: bytes
Server: LiteSpeed
Connection: close
Content-Length: 85258
添加代码后:注意第二组缓存控制并过期。
HTTP/1.1 200 OK
X-Powered-By: PHP/5.4.45
Cache-Control: public, max-age=2592000
Expires: Wed, 22 Mar 2017 02:01:16 GMT
Content-Type: text/html; charset=UTF-8
Link: <http://zilredloh.com/wp-json/>; rel="https://api.w.org/"
Link: <http://wp.me/1ZLfW>; rel=shortlink
Expires: Wed, 11 Jan 1984 05:00:00 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Vary: Accept-Encoding
Date: Mon, 20 Feb 2017 02:01:16 GMT
Accept-Ranges: bytes
Server: LiteSpeed
Connection: close
Content-Length: 85258