Restrict by IP in Apache behind Cloudflare
If you are using Cloudflare as first line of defense, and want to restrict by IP in the Apache webserver behind. Add this to your .htaccess:
SetEnvIF X-Forwarded-For "18.104.22.168" AllowIP <RequireAny> Require env AllowIP </RequireAny>
Where 22.214.171.124 is the IP address that you want to allow access to your site, just replace it by your IP address.