D
D
Darya Shvakh2019-01-11 06:00:29
htaccess
Darya Shvakh, 2019-01-11 06:00:29

Is it possible to configure htaccess so that any visitor's IP is blocked after the second visit to the site?

Good afternoon!
Is it possible to configure htaccess so that any visitor's IP is blocked after the second visit to the site?
That is, in order to visit the site it was possible only a limited number of times (2 in this case).
Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey S., 2019-01-11
@DariaShvakh

htaccess essential? An ordinary PHP script could catch IP addresses and log them to the database, and if the number of views > 2 would block the content. You can get confused and write a script that would pull out a list of IP addresses with the number of visits from a file, compare it with the current one, and write the address to the Htaccess prohibited list if visited more than 2 times. But these are crutches crutches =)

B
Boris Syomov, 2019-01-11
@kotomyava

Only on .htaccess it is not implemented.
You can set cookies in the application and check them in .htaccess using %{HTTP_COOKIE}, but this method is basically bad, and you still need to do something on the application side.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question