Blocking an IP with Apache can be done by modifying the .htaccess file or Apache configuration file.
Here’s how to do it:
Via .htaccess File:
1. Open or create your .htaccess file in the root directory of your website.
1. To block a specific IP address, add the following lines:
```
order allow,deny
deny from {IP address}
allow from all
```
Replace {IP address} with the IP address you’re trying to block. For instance, if you’re blocking IP address 123.123.123.123, your .htaccess file should look like:
```
order allow,deny
deny from 123.123.123.123
allow from all
```
1. Save the file.
Via Apache configuration File:
1. Open your Apache configuration file (httpd.conf)
1. To block an IP address or a whole range of IP addresses, you can use the “Require not ip” directive under the Directory tag. For example:
```
```
This will block 123.123.123.123 from accessing your site.
1. Save the file and restart your Apache server to make these changes take effect.
Note: Always backup your file before making any changes. Blocking IPs should be done carefully as you might end up blocking legitimate users. You might also need root or administrative access to make changes to the Apache configuration file.