Htaccess redirect is getting ignored

I’m using .htaccess to limit access to a certain page to a selected IP addresses only.

RewriteCond %{REQUEST_URI} ./admin
RewriteCond %{REMOTE_ADDR} !=XX.XX.XX.XXX
RewriteCond %{REMOTE_ADDR} !=X.XXX.XX.XX
RewriteRule ^(.
)$ https://www.domain.com [R=301,L]

This is working fine unless I enable Cloudflare. To prevent this from happening I added this IP to Firewall → Tools > IP Access Rules and set to allow. Next, I added it to Firewall Rules with all the features. Unfortunately this is not helping and the above mentioned redirect is not working.

Could anyone pin point me in the right direction?
Thanks in advance!

It’s quite possible your server isn’t properly configured to restore visitor IP addresses from Cloudflare:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.