How to Set Up Cloudflare to Protect a WordPress Site

17 Oct 20266 min read
Sefat Hossain, WordPress security specialist
By Sefat Hossain
Share
How to Set Up Cloudflare to Protect a WordPress Site

Quick answer

To set up Cloudflare for WordPress: create a Cloudflare account, add your domain, update your domain's nameservers to Cloudflare's, enable SSL (Full/Strict), turn on the WAF and bot protection, and add rate-limiting rules for wp-login.php and xmlrpc. This puts a security and caching layer in front of your site.

Key takeaways

  • Cloudflare sits in front of your site, filtering attacks and caching content.
  • Rate-limiting wp-login.php and xmlrpc blocks the most common WordPress attacks.
  • Use Full (Strict) SSL so the connection is encrypted end to end.

Cloudflare is one of the easiest ways to add a serious security and performance layer in front of your WordPress site — much of it free. Here's how to set it up so it actually protects you.

1. Add your domain to Cloudflare

Create an account, add your domain, and let Cloudflare scan your existing DNS records. Review them for accuracy.

2. Update your nameservers

Point your domain's nameservers to the ones Cloudflare provides. This routes your traffic through Cloudflare's network, where the protection happens.

3. Set SSL to Full (Strict)

This encrypts the connection end to end — between the visitor and Cloudflare, and between Cloudflare and your server. Avoid the "Flexible" setting, which leaves part of the path unencrypted.

4. Turn on the WAF and bot protection

Enable the web application firewall and bot-fight features to block common attacks and malicious crawlers at the edge.

5. Rate-limit the WordPress attack surface

Add rules to rate-limit or challenge requests to wp-login.php and xmlrpc.php — two of the most attacked WordPress endpoints. That single step blocks a large share of automated attacks.

Free security check

Worried your site is infected?

Get a free security assessment — I'll tell you if your WordPress site is compromised and exactly what it needs. No obligation.

Follow-up questions

People also ask

Cloudflare's free plan covers DNS, SSL, caching, and basic security for most sites. Paid plans add advanced WAF rules and more granular controls.

Worried about your own site?