Block an IP address with .htaccess

In case you have identified an unusually high number of requests from a particular IP address with nefarious intentions, we recommend implementing the following code to block that address.

For this example, I will block the 35.226.117.128 IP address. Add this code to the end of your .htaccess file.

<IfModule mod_setenvif.c>
 SetEnvIf AH_CLIENT_IP ^35.226.117.128 DENY=1
 Order allow,deny
 Allow From All
 Deny from env=DENY
</IfModule>

This will ensure that the traffic from that address will no longer be able to reach your server.