• Resolved normski52

    (@normski52)


    Hello. I am using the free version. I have blocked a range of IPs. I would like to redirect them to the home page. How do I do so?

    Thanks in advance

    Normski

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi @normski52,

    When an IP is blocked with Wordfence, we present them with a blocking page.
    It has been suggested that this blocking page could be customized.

    However, there is another way to do this.
    Add this to the beginning of your .htaccess:

    RewriteEngine on
    RewriteCond %{REMOTE_ADDR} #####
    RewriteCond %{REQUEST_URI} !=/home.php
    RewriteRule .* /home.php [L]

    Change /home.php to what page blocked people should be redirected to.
    Change ##### to a regex pattern to match your IP ranges.

    Generate a regex pattern with an IP range here: https://d-fault.nl/CIDRtoRegEx

    1. For example, my IP range could be 1.1.1.1/24
    2. Converted, it looks like ^(1\.1\.1\.(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5])))$
    3. Then the rule would be RewriteCond %{REMOTE_ADDR} ^(1\.1\.1\.(?:[0-9]|[1-9][0-9]|1(?:[0-9][0-9])|2(?:[0-4][0-9]|5[0-5])))$

    Now when people visit, and their IP is within that range, they will be automatically redirected to /home.php, and if they try to navigate to a different page, they will be sent right back.

    Dave

    Thread Starter normski52

    (@normski52)

    wfdave

    Many thanks for your response. That’s much appreciated but it looks a bit too complicated for me. I will see if my developer can carry that out for me.

    All the best.

    Hi again,

    No problem!

    Could I ask why you want to redirect blocked IPs to a different page?
    Would it help if in Wordfence, you could customize the locked out/banned page?

    Dave

    Thread Starter normski52

    (@normski52)

    Hello and thanks again Dave.

    An individual is accessing pages on my website that I don’t want them to access. I don’t want to alert them to the fact that I have detected the intrusion. I would like to send him/her back to the home page of the site.
    But, as an alternative it would help if I could redirect to the home page.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Redirect blocked IPs’ is closed to new replies.