Best Cache Rules for Wordpress

Especially people who experience problems with their site theme after cache rules can easily use the following rules. In a nutshell, this rule effectively caches static assets like CSS, JS, and images, while excluding dynamic content and files that may change frequently. Also excluding rank math seo , sitemaps and rss(feed)

Go menu > caching > cache rules

(ends_with(http.request.uri.path, "/") and not starts_with(http.request.uri.path, "/wp-") and not http.cookie contains "wp-" and not http.cookie contains "wordpress" and not http.cookie contains "comment_" and not http.request.full_uri contains "/feed" and not http.request.full_uri contains "rankmath/v1/" and not http.request.full_uri contains ".txt" and not http.request.full_uri contains ".xml" and not http.cookie contains "no_cache" and not http.cookie contains "PHPSESSID" and not http.request.full_uri contains ".xlst")

If you use Woocommerce you need add (and not http.cookie contains “woocommerce_”)

3 Likes