Block IP using .htaccess
Now, create a file named .htaccess in your website document root directory and add these example lines:
You are required to change the IP address to be blocked in the above configuration. Here you can block a single IP or IP ranges. You can also write one or more IPs in a single line with space separated. The user will see the following error message when tried to access from a blocked IP address.
For more details visit the following link: https://httpd.apache.org/docs/2.4/howto/access.html
