Last Updated on 21st September 2021 by Ajmer Singh
Do you want to know how to setup Cloudflare in WordPress site?
Cloudflare is one of the best free content delivery networks and security services available in the market.
They offer a free CDN service that enhances the speed of your site alongside a security service that ensures your site is secured from bot and third-party attacks.
Often, beginners are of the opinion that setting up Cloudflare on WordPress is extremely difficult.
In this guide, you will learn how to setup Cloudflare in wordpress and a lot more.
What is CDN and its importance?
CDN is an acronym that stands for Content Delivery Network, made up of a network of servers, it enhances the effective distribution of website files, content to users based on their geographic location.
It solves the problem of users accessing website files or content on the same server, while these could cause a delay in website page load speed,
In addition, CDN provides a network of servers in different geographic locations across the globe, where users can access the content.
Whenever a user makes a request, the CDN server closer to the user’s location responds to the request.
For example, if a Nigerian wants to access an Indian-hosted site, a CDN server in Nigeria will handle the request, not the main server in India.
CDN allows requests to be handled by the nearest servers, hence speed is efficient because while the server can be loaded due to the fact that all user’s requests are connected to it, CDN prevents that by offering multiple network servers.
Want to learn more about CDN’s, read our article on what is CDN and its use.
What is Cloudflare CDN and its benefits to your wordpress site?
Cloudflare is one of the best and popular CDN services on the internet.
Apart from the CDN services for best speed delivery it offers, it also offers security services to help prevent bots and third-party attacks.
They offer a free basic plan for blogs and small businesses, but to unlock more Cloudflare features, you can subscribe to their business plan. It costs $200/month.
Benefits of using Cloudflare on your wordpress site
The Cloudflare CDN services provide you with lots of benefits which include:
- A faster page load time: This is because Cloudflare caches your content across a network of servers, based on the user’s location, you tend to enjoy the speed benefit of using Cloudflare CDN.
- A decrease in bandwidth usage: Similarly, as Cloudflare enhances the speed of your site, it also decreases bandwidth usage via its caching features.
- Traffic: Cloudflare helps to sort out bot traffic and other negative traffic from third parties.
- Enhanced security: Conclusively, Cloudflare offers a firewall, DDoS protection, and free SSL to enhance security on your WordPress site
How to setup Cloudflare in WordPress
Installing and setting up Cloudflare on wordpress is easy, kindly follow the guide we have provided below:
To begin, you need to first,
1. Create a Cloudflare account:
Visit the Cloudflare website on cloudflare.com, click on the ‘Sign up’ button to create an account.
On the next page, provide your email address and password, after which you click on the ‘Create account button
2. Add your domain name to Cloudflare
The second step on how to setup Cloudflare in wordpress is to Click on +Add Site and write down your site name (like findmytricks.com).
Do not use other things like https or www.
You will see, we are querying your DNS Records. Click next.
3. Select a plan.
If it is a small business or personal blog we recommend that you continue with the free plan.
However, you can choose whatever plan suits your needs.
but in this guide, we choose the free plan.
4. Check the DNS query results for your website.
Once you have added your wordpress site to Cloudflare, you will receive a notification indicating that you enable or disable Cloudflare for subdomains.
Click or tick all status(till www).
What you need to verify is that an orange is displayed on your primary domain, Now click on the continue button to proceed to the next step.
4. point your domain name to Cloudflare nameservers
The fourth step is to replace your previous nameservers with Cloudflare.
To do this, simply open a new tab and navigate to your hosting panel, Replace your previous name server with Cloudflare and click on ‘update’.
Return to the Cloudflare page and click on the ‘done, check nameservers‘ button.
For example, if you are using Godaddy then :
- My products
- Name servers (change). It will take around 24 hours as they say, but it generally takes only a few minutes.
If you will see the status: Website not active (DNS modification pending), then click on recheck nameservers. After that, you will see the status active.
Most of the things are not important, so I will tell you about important things only.
As you are just signed up, you will see your results after some time.
You will see your analytics after some time.
Change your DNS settings here if you don’t change them at the start.
If you have an SSL certificate then enable full or full strict mode otherwise go for flexible.
This will show you your SSL certificate, if active.
Enable always to use https.
Change HSTS settings,
max-age – 12 months
include subdomains – on
preload – on
Enable onion routing, TLS 1.3, and Automatic https rewrites.
If you don’t have an SSL certificate then here you can create your free TLS certificate signed by Cloudflare on your origin server.
– Enable accelerated mobile links
– Enable Brotli
– Enable Rocket loader
Caching – Standard
Browser cache expiration – Make it default or you can change it according to your need.
Always online – Make sure it is on.
The page rule setup allows you to customize how you want Cloudflare to work on some of your specific pages.
Cloudflare is quite useful in securing the most important pages on your WordPress site like the WPadmin area, login page, etc.
The Cloudflare account is limited to three-page rules.
However, if you are interested in adding new page rules, you will be charged $5 on a monthly basis.
This package unlocks 5 more additional rules.
However, in this guide, we will be using the free plan.
From the image below, you can see that I have already created my page rules, but not to worry, I will walk you through the process of setting yours up.
To set up page rules:
First, navigate to the page rules option at the top of your Cloudflare homepage.
Click on the ‘create page rule’ button
Page rule 1
Click on create page rule.
Enter your website name,
Okay, let me show you the example of my website.
findmytricks.com/* (for those who don’t have an SSL certificate)
HTTP://*findmytricks.com/* (for SSL certificate users)
Add a setting (click)
Browser cache TTL – a day
Cache Level – cache everything
Page Rule 2
Create a new page rule (for home page)
Enter your website name
https://*findmytricks.com/wp.admin* (for SSL certificate users)
findmytricks.com/wp.admin* (for non-SSL certificate users)
Add a setting
Browser integrity check – ON
(With this Cloudflare will stop blacklisted IP addresses or websites to visit your websites and make harm.)
Always online – Off
Security level – High
Browser Cache TTL – 30 minutes
Disable apps – apps are disabled
Disable performance – performance is disabled
Page Rule 3
Create a new page rule
enter https://*findmytricks.com/*preview=true* (for SSL Certificate users)
findmytricks.com/*preview=true* (for non SSL certificate users)
Add a setting
Browser Integrity check – On
Always online – Off
Security level – High
Browser cache TTL – 30 minutes
Cache level – Bypass
Disable apps – Apps are disabled
Disable performance – Performance is disabled
These 3-page rules are recommended by Cloudflare, so if you can’t understand anything then just copy these rules.
Note: Changing your domain nameservers can take a few days to propagate the internet. during this period, your page may or may not face any downtime issues.
To check if the nameservers update has been completed, you will receive a confirmation email from Cloudflare, on the other hand, you can check your status update on the Cloudflare website consecutively.
How to setup Cloudflare plugin in WordPress
Another way to setup Cloudflare in WordPress is to use the Cloudflare plugin.
If you have consulted the previous method, then there is no need to tune in to this.
However, if you prefer to use this method, kindly follow the guide below
1. Visit the plugin section on your WordPress dashboard
2. Click on “Add new”
3. Type “Cloudflare” into the search query
4. Click on ‘install’
5. Click on ‘Activate’
Once you have activated the plugin, go to the settings>cloudflare on your WordPress dashboard
Click the link to sign In.
On the next page, you will need to type in your email address and API key.
To get your Cloudflare API key, visit your ‘account area’ on the Cloudflare website.
Simply navigate to the “My Profile page, open and click on the API tokens as displayed below
After that, navigate to the global API key sections
Click on the ” View” button to get your API key.
Your API key will be displayed as a popup message.
Copy the key.
Return to your WordPress dashboard to enter your email address and API key.
Click on the “Save API credentials”
Finally, you will need to optimize Cloudflare for WordPress and this is done with just a single click.
This one-click solution allows you to implement all the Cloudflare settings needed for speed and security
In conclusion, I hope you have learned how to setup Cloudflare on your wordpress site.
Remember that the main goal of the Cloudflare CDN is to enhance the effective distribution of website files to avoid delay or lagging of your site if the content is served on a single server.
Setting up Cloudflare on your wordpress site is an easy task as long as you follow the guidelines I have provided above.
In case you encounter any difficulty during the setup, I will be at the comment section waiting for you.
People also search for :
Ajmer Singh is the Founder & Author of Findmytricks. He is a Passionate Blogger, Content writer & WordPress developer. He loves sharing content related to WordPress and Blogging. He enjoys playing games in his free time.
1. “Be yourself. Everyone else is already taken.”
2. “First, learn the rules, then break them”