Problem with ip blocker (error 403)

hi, i have a problem and i need a hand urgently please. Basically in the error settings area of the site, I entered a URL in .php in the 403 error, The problem is that when I go to block an ip, the error page 403 does not appear. But I get the following browser error (ERR_TOO_MANY_REDIRECTS) not making the error page I entered appear. Can you help me out? Thanks :frowning:

Please fill up according to the template.
What is the url?

We need more details

More details please. Whatever you had described are too vague

3 Likes

So, I’ll explain better. If I want to block someone’s IP to prevent them from accessing my site. The user who has been blocked receives the browser error. But I would like the error page made by me to come out.

EXAMPLE:

PAGE ERROR: http://myblog.com/error403.php

instead of exiting, exit this URL. Dice to the user I blocked (** ERR_TOO_MANY_REDIRECTS **

ps. I do not enter the url of my site because they are small tests that I am doing, so it is a bit of a mess

Right, it seems like there is a bit of a conflict here. When someone with a blocked IP address is trying to access your site, they get blocked and redirected to the error page. But they are also being blocked from accessing the error page, which redirects them to the same error page. Which results in a loop that continues until the browser gives up.

I think the way to fix it is to now use a URL, but a file path, as the error page. That way, the error page is loaded on the same URL as they were trying to visit without any redirect.

You can set this up by manually editing the .htaccess file on your site. In the file called .htaccess, you’ll find a line that looks like this:

ErrorDocument 403 http://myblog.com/error403.php

Please change this line to something like this:

ErrorDocument 403 /error403.php
5 Likes

@ArkeoLoop it also depends on the reason why you want to block a specific IP

if you want to protect yourself from some attacks that consume hosting resources (CPU, RAM, etc.)

then it’s better if you don’t have something that will lead someone/bot whose access is prohibited to some .PHP file, because PHP consumes system resources.

Or at least use HTML which is a static file

6 Likes

Perfect, thanks a lot. I was able to solve the problem.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.