Restrict access to a specific country to a website


I am wondering if it is possible to make my site accessible only for a specific country. Therefore, anyone trying to visit a website outside a specific country will not have access.

I thought to get the php IP Geo Locator script and do the forwarding if the IP address is from the country I am solving.

How would you recommend it?

Thanks.

EDIT

It does not have to be 100% accurate. I just need PHP code that will do what I need. By the way, the country is Romania. Thank you :)

+4
source share
1 answer

The answer depends on what you mean by "country-specific."

  • What should I do if a domestic computer has an IP address that is not on your list? This computer does not have access, but it is located in the country.

  • What should I do if a computer outside the country has an IP address on your list? This computer will have an address, but it is not located in the country.

  • What to do if a router with an internal IP address sends requests from abroad? What if the domestic router is part of the TOR network?

  • What if a citizen leaves the country and wants to access your website internally from another country? A citizen will have an IP address, not your list, and he will be denied access.

Until you define "country-specific", your question will not be answered.

+4
source

Source: https://habr.com/ru/post/1384676/


All Articles