Du kan använda .htaccess för att blockera åtkomst till din webbplats från enskilda IP-adresser eller IP-intervall.
Följande syntax kan användas för att blockera med:
<RequireAll>
Require all granted
# Blockera enstaka 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.2
</RequireAll>
Och om du vill blockera all åtkomst utom från enstaka IP-adresser:
Require ip 69.46.36.0/27
Require ip 192.0.2.1
Lägg bara till de relevanta raderna i webbhotellets fil .htaccess.
Se även https://httpd.apache.org/docs/2.4/howto/access.html#host
Om du vill blockera åtkomst från utvalda länder kan du använda det här verktyget: https://www.ip2location.com/free/visitor-blocker
Artikel från supportkategorin: PHP