Dino Geek, try to help you

How to block an IP with Apache?


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:

```
Require all granted Require not ip 123.123.123.123

```
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.


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use