Secure the WordPress Login Page by Limiting Access to Certain Country



Using Cloudflare Firewall, you can limit access to WordPress login page for your whitelisted country.

  • This would be heplful to prevent brute force attack from the outside country.


  1. Login to Cloudflare (Select account > domain )

  2. Go to Crypto Menu and create a new Firewall rule

  3. Rule name: Allow Login page only for India

  4. Country > Doesn’t equal to > India

  5. URI Path > contains > wp-login.php

  6. Block


  • Only whitelisted country can access login page, and non-other.

Edit: Made some corrections.

Thanks & Regards,

Someone is trying really hard to sneak into my admin dashboard
How to Setup Free Cloudflare CDN for Wordpress (Tutorial)?

:heart_eyes::heart_eyes::heart_eyes::heart_eyes: Great trick.


@GulshanKumar Sorry but it is not working.


Before it was working fine, but now at Nginx it won’t work.



(Check over VPN, it will work only for India)

Please try now it should work.

Cc: @abhishek

Thanks & Regards,


Ohh, you have updated the tutorial. Let me check now.


I have updated above guide. Please check if you missed in case. It should work.

Or can you paste screenshot how is the rule created by you in your Cloudflare dashboard?


It is working, thanks :grinning:


You’re welcome!


Update: It worked now.