How to set up Cloudflare Page Rules for WordPress

Cloudflare is a powerful content distribution network that can make your website load way faster. However by default the most important important features are disabled, I will explain how to enable them.

 

Page Rules

By default, Cloudflare does not cache  HTML content, this means it caches the java scripts and css, the small parts of your website, but not the bulk of it, the actually pages themselves. Cloudflare can be told to cache everything, but it needs to be told. Here’s how to do it AND do it in https, so the pages will load securely with ssl lock enabled.

 

These rules need to be in this exact order. Im using medinaminds.com as the domain, which is this site, obviously your will need to put your own domain in its place. The astericks * are very important and need to be put in exactly the same positions as I have.

Rule 1.

http://*medinaminds.com/*

Always use HTTPS ON

Rule 2.

 *medinaminds.com/wp-*in*/*

cache level by pass

Rule 3.

*medinaminds.com/*

 

This should allow you to load super fast, with ssl enabled and still have full access to the wordpress admin. If you have any other tips, please share as this took me ages to work out!

Ahmed Hilmi

Ahmed Hilmi

Ahmed is a contributor for Medina minds. He has also written the book Shield of the Believer

One thought on “How to set up Cloudflare Page Rules for WordPress

  1. Hello, as I found that woo doc says :

    If using caching plugins (such as WP Super Cache or W3 Total Cache), make sure you exclude the following pages from the cache through their respective settings panels:
    Cart
    My Account
    Checkout

    Now my question is, since I have integrated BOTH W3 Toatal cache and cloudfare CDN, what do I have to do here?
    1. I added exception for cart,my-account,checkout in W3 total>Page cache>Never cache the following pages. Do I need to add exception for ‘shop’ page as well(since it has a dynamic -ajax- add to cart feature) ?
    2. Now the most important part is, should I add the same exceptions in CloudFare ‘page rule’ as well ?? (cloudfare allows only 3 page rule for free accnt)
    3. I also want to know what shoud I set in “Browser Cache Expiration” in cloudfare setting – 4hr or Respect existing headers ?
    4. Do I have to set any page rule for all page caching in Cloudfare ?

Leave a Reply

Your email address will not be published. Required fields are marked *