Restrict website to access specific country

2019-06-27 12:50发布


I am wondering if it's possible to make my website only available to a specific country. So anyone who tries to visit the website outside the specific country, will not have access.

I was thinking of getting a php IP Geo Locator script and do a redirect if they IP address is from the country I decide.

How would you guys recommend it?

Thank you.

EDIT

This doesn't have to be 100% accurate. Just need the php code that will do what I need. The country is Romania by the way. Thanks! :)

1条回答
▲ chillily
2楼-- · 2019-06-27 13:15

The answer depends on what you mean by "available to a specific country".

  1. What if an in-country computer has an IP address not on your list? That computer won't have access, but it's located in country.

  2. What if an out-of-country computer has an IP address on your list? That computer will have address, but it's not located in country.

  3. What if a router with an in-country IP address forwards requests from out-of-country? What if an in-country router is part of the TOR network?

  4. What if a citizen leaves the country and wants to get access to your in-country web site from another country? The citizen will have an IP address not your list and will be denied access.

Until you define "available to a specific country" your question cannot be answered.

查看更多
登录 后发表回答