Blockera åtkomst från IP-adresser

Du kan använda .htaccess för att blockera åtkomst till din webbplats från vissa IP-adresser eller IP-intervall.

Följande syntax kan användas för att blockera med:

<RequireAll>
Require all granted

# Blockera enskild IP
Require not ip 192.0.2.1

# Blockera IP-intervall
Require not ip 192.0.2.0/24

# Blockera IP-intervall
Require not ip 192.0.2
</RequireAll>

Och om du vill blockera all åtkomst utom för vissa IP-adresser:

Require ip 69.46.36.0/27
Require ip 192.0.2.1

Lägg till de relevanta raderna i webhotellets .htaccess-fil.

Om du vill blockera ett specifikt land kan du använda dig av detta verktyg:
https://www.ip2location.com/free/visitor-blocker

Se även https://httpd.apache.org/docs/2.2/howto/access.html#host

Artikel från supportkategorin: PHP