You only get three free rules. How are you going to configure them to get the most out of them?
Updated: This is what worked best for me. Please share your own solutions.
Cloudflare is a Content Delivery Network or CDN. Instead of your server having to serve up every file with each new, non-cached browser request, the CDN sends it from it’s network instead. This saves a bitload (pun) of data and time. There are many available but free is hard to pass up when your a small player in a cutthroat internet. A big part of SEO also depends on speed, as in how fast your page gets loaded, and if your on a shared hosting service then you should consider using a CDN like Cloudflare, which will speed up the delivery of your static content in mind blowing ways.
In this guide, I’m focusing on a blog site configuration and no commerce involved. To be honest, I haven’t studied out a best use solution to WooCommerce over Cloudflare as yet, but these rules should work well in WooCommerce also.
Also, this isn’t a WordPress beginner article, but if your willing to try, and search out the details, you’ll figure it out. Always ask questions and ignore the pompous self appointed Internet Gods that tend to flame the little people. If I forgot to cover something here, tell me, or just ask questions in the comment section or contact form.
What needs to be in place to begin?
- Create a free Cloudflare account. (Signup)
- Add your domain to the account and change your name servers at your domain registrar to the ones Cloudflare lists in your setup dialog.
- Your site should use DNS from Cloudflare in orange proxy mode to avoid issues and be able to use page rules effectively. More so for the paid version that allows URL forwarding. See “Why isn’t a Page Rule working?
A few considerations
You’re allowed to have three page rules on each site that you have active with your free Cloudflare account. Cloudflare page rules allow wild cards, but do not allow regular expression, aka regex. The wildcard character is the * . You can only use 5 wildcards per page rule in the URL string.
I will not go into explanations of rule features or settings. Please review the Cloudflare Tutorial for that information.
Rules for the WordPress Admin
Rule 1: *technoogies.com/wp-a*
Rule 1 is to turn off everything you can that interferes with the WordPress admin interface. It also adds an increased level of security to protect the most privileged part of your website. You could spell out admin if you like, it really won’t matter, but I’m lazy.
Rule 2: *technoogies.com/*=*
Rule 2 I use to allow editors to function properly and uses the same features as rule 1. Elementor, Oxygen Builder, Beaver Builder, Divi, WPBakery, Cobalt Apps, CSS Hero, Microthemer, typically have an equal sign somewhere in the URL string. Because not every editor will have “wp-admin” in the URL string, it’s a good idea to have the security setting set to high as well.
The last rule for everything else
Rule 3: *technoogies.com/*
Rule 3 is going to use cache for everything that the first two rules don’t catch. This one can’t be first or it will mess with your ability to use the admin area and editors.
I’ve updated Rule 3 to include the Cloudflare recommendations for WordPress. Cloudflare for WordPress plugin defaults to turn “Hotlink Protection” off, but some of you are going to want this on to keep other sites from loading your images into their content, thus placing the burden on you.
Some if you will have other needs. Mine are simple for technoogies.com. Remember, Rocket Loader is nothing but trouble for WordPress. Also, if your using a caching or minification plugin already, your going to have to do some testing to figure out what works best. Sometimes using just Cloudflare minification is fastest and sometimes you can leave both on, but both minification systems on at the same time will usually break things and they’re performing the same function. You will typically have more control on the WordPress end rather than Cloudflare.
There is a theory though that pre-minification prior to Cloudflare minification will speed up the minification side on Cloudflare and possibly remove dead weight that Cloudflare will miss. I don’t know, but it could have merit.
Last note – Never trust your browser, even if you cleared cache. If you changed something, cleared browser cache, and it looks unchanged, close the browser and reopen it. I’ve waisted many, many hours not doing this simple step.
- What settings are applied when I click “Optimize Cloudflare for WordPress” in Cloudflare’s WordPress plugin? (I don’t use this plugin and set these myself, but the info is good)
- Understanding and Configuring Cloudflare Page Rules (Page Rules Tutorial)
- Using Wildcards in Page Rules (The ‘Forwarding URL’ setting is not available for the free page rules, but the other options are.)
- Caching Static HTML with WordPress/WooCommerce (This will NOT work with the freebie rules.)