I’m using Cloudflare nameservers and tried to whitelist Cloudflare IPs through htaccess file, but it results in a 403 Forbidden error for my Wordpress login.
Here are the directives I used in htaccess file:
# Apache 2.2: Whitelist Cloudflare IPs <IfModule !authz_core_module> Order Allow,Deny Allow from 22.214.171.124/20 Allow from 126.96.36.199/22 Allow from 188.8.131.52/22 Allow from 184.108.40.206/22 Allow from 220.127.116.11/18 Allow from 18.104.22.168/18 Allow from 22.214.171.124/20 Allow from 126.96.36.199/20 Allow from 188.8.131.52/22 Allow from 184.108.40.206/17 Allow from 220.127.116.11/15 Allow from 18.104.22.168/12 Allow from 22.214.171.124/13 Allow from 126.96.36.199/22 </IfModule> # Apache 2.4+: Whitelist Cloudflare IPs <IfModule authz_core_module> <RequireAll> Require ip 188.8.131.52/20 Require ip 184.108.40.206/22 Require ip 220.127.116.11/22 Require ip 18.104.22.168/22 Require ip 22.214.171.124/18 Require ip 126.96.36.199/18 Require ip 188.8.131.52/20 Require ip 184.108.40.206/20 Require ip 220.127.116.11/22 Require ip 18.104.22.168/17 Require ip 22.214.171.124/15 Require ip 126.96.36.199/12 Require ip 188.8.131.52/13 Require ip 184.108.40.206/22 </RequireAll> </IfModule>
This blocked me from login in Wordpress, so I tried to add this along with the above directives:
<Files wp-login.php> <IfModule mod_authz_core.c> Require all granted </IfModule> <IfModule !mod_authz_core.c> Order Allow,Deny Allow from all </IfModule> </Files>
But this didn’t work!
What can I do, please, to resolve this issue?