适用于普通WordPress博客站点的CloudFlare缓存规则 [教程]

分享三条适用于普通WordPress博客站点的CloudFlare缓存规则

适用于普通WordPress博客站点的CloudFlare缓存规则-资源栈

(本缓存规则不适用于多用户支持的 WordPress 主题、插件就不适用了,那需要大量的调试整理分析定制专属缓存规则的,这点儿一定要搞清楚,并且不是所有多用户的主题、插件可以实现 CDN 智能缓存规则的。)

根据你描述的内容,下面是针对标准普通WordPress博客站点的CloudFlare缓存规则的配置细节:

  1. 不缓存目录链接
  • 规则名称: A 不缓存目录链接
(http.request.full_uri eq "https://yourdomain.com/wp-admin/*") or (http.request.full_uri eq "https://yourdomain.com/*preview=true*") or (http.request.full_uri eq "https://yourdomain.com/?s=*")
  1. 登录评论不缓存
  • 规则名称: B 登录评论不缓存
(starts_with(http.request.full_uri, "https://yourdomain.com/") and http.cookie contains "wordpress_sec_") or (starts_with(http.request.full_uri, "https://yourdomain.com/") and http.cookie contains "wordpress_logged_in") or (starts_with(http.request.full_uri, "https://yourdomain.com/") and http.cookie contains "comment_")
  1. 缓存
  • 规则名称: C 缓存
(starts_with(http.request.full_uri, "https://yourdomain.com/") and not http.cookie contains "wordpress_sec_" and not http.cookie contains "wordpress_logged_in" and not http.cookie contains "comment_")

在配置这些规则时,确保将yourdomain.com替换为你的实际域名。此外,调整规则的顺序非常重要,它们应该按照A、B、C的顺序排列,以便正确地处理请求。

在完成规则设置后,不要忘记清除CloudFlare的缓存,这样新的规则才能立即生效。这可以通过CloudFlare控制面板中的“缓存”>“配置”>“清除所有内容”来完成。

请注意,这些规则适用于单用户模式的WordPress博客,如果使用了多用户功能或者某些特定的插件,可能需要额外的调整来适应不同的场景。

温馨提示: 本文最后更新于2024-07-30 19:20:16,某些文章具有时效性,若有错误或已失效,请在下方 留言或联系 站长
© 版权声明
THE END
喜欢就支持一下吧
点赞2242 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容