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 188.8.131.52/20 Allow from 184.108.40.206/22 Allow from 220.127.116.11/22 Allow from 18.104.22.168/22 Allow from 22.214.171.124/18 Allow from 126.96.36.199/18 Allow from 188.8.131.52/20 Allow from 184.108.40.206/20 Allow from 220.127.116.11/22 Allow from 18.104.22.168/17 Allow from 22.214.171.124/15 Allow from 126.96.36.199/12 Allow from 188.8.131.52/13 Allow from 184.108.40.206/22 </IfModule> # Apache 2.4+: Whitelist Cloudflare IPs <IfModule authz_core_module> <RequireAll> Require ip 220.127.116.11/20 Require ip 18.104.22.168/22 Require ip 22.214.171.124/22 Require ip 126.96.36.199/22 Require ip 188.8.131.52/18 Require ip 184.108.40.206/18 Require ip 220.127.116.11/20 Require ip 18.104.22.168/20 Require ip 22.214.171.124/22 Require ip 126.96.36.199/17 Require ip 188.8.131.52/15 Require ip 184.108.40.206/12 Require ip 220.127.116.11/13 Require ip 18.104.22.168/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?