RewriteCond %{REQUEST_URI} ^/wp-admin [NC]
RewriteCond %{HTTP:CF-Connecting-IP} !^181\.177\.141\.10$
RewriteCond %{REMOTE_ADDR} !^181\.177\.141\.10$
RewriteCond %{HTTP:CF-Connecting-IP} !^58\.69\.175\.29$
RewriteCond %{REMOTE_ADDR} !^58\.69\.175\.29$
RewriteCond %{HTTP:CF-Connecting-IP} !^200\.58\.86\.(3[0-9]|2[0-9]|1[0-9]|[0-9])$
RewriteCond %{REMOTE_ADDR} !^200\.58\.86\.(3[0-9]|2[0-9]|1[0-9]|[0-9])$
RewriteRule ^ - [F,L]

#ideal porque se combina si usas cloudlfare o no
------------------------------------------------



nano /etc/apache2/conf-available/remoteip.conf

(Si el archivo no existe, créalo.)

Agrega esta configuración para Cloudflare:


<IfModule mod_remoteip.c>
    RemoteIPHeader CF-Connecting-IP
    RemoteIPTrustedProxy 172.68.0.0/16
</IfModule>

a2enconf remoteip
systemctl restart apache2



---------------------------------------------
otra opción es (agregar) en .htaccess
RewriteEngine On
# Bloquear acceso a /wp-admin salvo para la IP 181.177.141.10
RewriteCond %{REQUEST_URI} ^/wp-admin [NC]
RewriteCond %{REMOTE_ADDR} !^181\.177\.141\.10$
RewriteCond %{REMOTE_ADDR} !^200\.58\.86\.(2[0-9]|1[0-9]|[0-9])$
# Rango 200.58.86.0 - 200.58.86.31
RewriteCond %{REMOTE_ADDR} !^45\.150\.175\.131$
RewriteCond %{REMOTE_ADDR} !^181\.177\.141\.18$
RewriteCond %{REMOTE_ADDR} !^203\.0\.113\.42$
RewriteCond %{REMOTE_ADDR} !^45\.67\.89\.123$
RewriteRule ^ - [F,L]

---------------------------------------------------------------------
-----------sin usar remoteip APLICADA--USANDO CLOUDLFLARE------------
---------------------------------------------------------------------
# Bloquear acceso a /wp-admin salvo para IPs espec  ficas usando CF-Connecting-IP
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/wp-admin [NC]
RewriteCond %{HTTP:CF-Connecting-IP} !^181\.177\.141\.10$
RewriteCond %{HTTP:CF-Connecting-IP} !^58\.69\.175\.29$
RewriteCond %{HTTP:CF-Connecting-IP} !^200\.58\.86\.(3[0-9]|2[0-9]|1[0-9]|[0-9])$
# Red de la oficina 1 Rango 200.58.86.0 a la 39
RewriteRule ^ - [F,L]
#tipico para cloudflare
---------------------------------------------


--------------------------otra opción----------------
agrego esto en 
isconfig/domain/options/Apache Directives

<Directory /var/www/clients/client0/web1/web/wp-admin>
    Require all denied
    Require ip 181.177.141.10
</Directory>
----------------------------------------------------

para comprobar
creo un fichero info.php con este contenido

<?php
echo "REMOTE_ADDR: " . $_SERVER['REMOTE_ADDR'] . "<br>";
echo "X-Forwarded-For: " . $_SERVER['HTTP_X_FORWARDED_FOR'] . "<br>";
echo "CF-Connecting-IP: " . $_SERVER['HTTP_CF_CONNECTING_IP'] . "<br>";
?>

