1

How Can I block all IP Adresses that start like this 2a01:598: in my htaccess file?

I tried:

Deny from 2a01:598::/28

and i also tried it like this:

Deny from 2a01:598::

But it doesnt work? What am I doing wrong?

My wordpress website is running on shared Hosting.

Looking forward to your answers.

Benjamin S
  • 51
  • 3

1 Answers1

0

As described in Apache 2.4 Access Control:

The AllowDeny, and Order directives, provided by mod_access_compat, are deprecated and will go away in a future version. You should avoid using them, and avoid outdated tutorials recommending their use.

Use Require, instead:

Require not ip 2a01:598::/28

This should work in the .htaccess context, unless limited by an AllowOverride in the server configuration.

Esa Jokinen
  • 43,252
  • 2
  • 75
  • 122
  • I just tried it to block my own ipv6 adress. But even if i use the described code i can access my website. If I block my own ipv4 range it is working just fine. BUt not with my Ipv6? – Benjamin S Nov 09 '19 at 17:30
  • 2
    Are you sure the connection is made over IPv6? – Esa Jokinen Nov 09 '19 at 17:39
  • Yes if i go to whatismyip.com my ipv6 and my ipv4 adress is shown. And if block my exact ipv6 adress i cant connect. But if i only block like this 2a01:598::/28 im still able to visit my site? – Benjamin S Nov 09 '19 at 17:41
  • Is there a way to block all ipv6 connections to my website and only allow ipv4 adresses? – Benjamin S Nov 09 '19 at 17:48
  • The `2a01:598::/28` refers to range from `2a01:590:0:0:0:0:0:0` to `2a01:59f:ffff:ffff:ffff:ffff:ffff:ffff`. Are you positive your IP is on that range? – Esa Jokinen Nov 09 '19 at 17:50
  • Im not sure what you mean. I have list of ips that visited my site. All of the ips started with 2a01:598:xxxx? Maybe I can send you the list? – Benjamin S Nov 09 '19 at 18:03
  • That's not necessary. Just trying to rule some obvious reasons out. – Esa Jokinen Nov 09 '19 at 18:06