限制网站访问特定国家
我想知道是否可以使我的网站仅适用于特定国家/地区。 因此,任何试图访问特定国家/地区之外的网站的人都将无法访问。
我正在考虑获取一个 php IP 地理定位器脚本,并在 IP 地址来自我决定的国家/地区时进行重定向。
大家会如何推荐呢?
谢谢。
编辑
这不一定是 100% 准确。只需要 php 代码即可完成我的需要。 顺便说一句,这个国家就是罗马尼亚。谢谢! :)
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! :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
答案取决于“适用于特定国家/地区”的含义。
如果国内计算机的 IP 地址不在您的列表中怎么办?该计算机无法访问,但它位于国家/地区。
如果您的列表中有一台国外计算机的 IP 地址怎么办?该计算机将有地址,但它不在所在国家/地区。
如果具有国内 IP 地址的路由器转发来自国外的请求怎么办?如果国内路由器是 TOR 网络 的一部分怎么办?
如果公民离开该国家/地区并希望从另一个国家/地区访问您所在国家/地区的网站,该怎么办?该公民将拥有一个不在您列表中的 IP 地址,并且将被拒绝访问。
在您定义“适用于特定国家/地区”之前,您的问题无法得到解答。
The answer depends on what you mean by "available to a specific country".
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.
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.
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?
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.