wordpress的首页,一般都不会缓存,即使clouflare配置了缓存策略。可以进行强制缓存,通过修改主题functions文件配合cloudflare缓存规则实现。我使用的是astra主题。
修改主题文件
编辑astra主题的functions.php,加入下面内容
1 | function allow_home_cache() { |
设置cloudflare缓存规则
在缓存->Cache rules中,新建缓存规则,编辑表达式
(http.request.full_uri wildcard "https://your.domain/")