Restrict website to access specific country

*爱你&永不变心* 提交于 2019-12-10 18:16:35

问题



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:


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.



来源:https://stackoverflow.com/questions/8384421/restrict-website-to-access-specific-country

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!