cloudflare缓存wordpress的页面规则

使用 cloudflare page rules 设置缓存 cache wordpress, 加速网站访问速度

规则一: 不缓存wp-admin目录


localhost.com/wp-admin*
Cache Level = Bypass
Security Level = High

规则二: 不缓存文章预览


localhost.com/*preview=true*
Cache Level = Bypass

规则三: 缓存所有文件


localhost.com/*
Browser Cache TTL = 30 minutes
Cache Level = Cache Everything
Edge Cache TTL = 2 hours

可选规则: CDN缓存301跳转


localhost.com
Forwarding URL = 301 - Permanent Redirect
https://www.localhost.com

其他规则: 仅缓存首页


https://www.localhost.com
Browser Cache TTL = 30 minutes
Cache Level = Cache Everything
Edge Cache TTL = 2 hours

安装Change wp-admin login 插件


使用这个插件可以重定向/wp-login.php到自定义URL绕过缓存, 比如/wp-adminadmin
https://wordpress.org/plugins/change-wp-admin-login/
https://downloads.wordpress.org/plugin/change-wp-admin-login.zip

附送wordpress蜘蛛访问robots.txt规则


User-agent: *
Disallow: /wp-admin/
Disallow: /wp-content/
Disallow: /wp-includes/
Disallow: /*/comment-page-*
Disallow: /*?replytocom=*
Disallow: /*/trackback
Disallow: /feed
Disallow: /*/feed
Disallow: /comments/feed
Disallow: /?s=*
Disallow: /*/?s=*\
Disallow: /attachment/
Disallow: /author/
Disallow: /user/

此处评论已关闭