限制对网站的访问

发布于 2024-09-15 02:22:57 字数 119 浏览 2 评论 0原文

我需要限制某些地区对我的网站的访问。 我怎样才能不允许来自某些国家/地区访问我的网站?(例如来自亚美尼亚) (我必须走哪条路?.htaccess?或者只能通过ip 地址?)

i need to limit visits to my site from some regions.
how can i don't allow to visit my site from some country?(from Armenia for example)
(what is the way i must go? .htaccess? or maybe only by ip addresses?)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡看悲欢离合 2024-09-22 02:22:57

您可以利用地理定位。 http://www.geoplugin.com/webservices/php 有一个可靠的 API,可以提供您可以根据访问者的 IP 地址获得有关某个区域的一组良好信息。使用此功能,您可以记录对数据库的访问,并在 X 数量的访问者之后切断区域或与数据库中的黑名单进行比较。

请注意,代理用户可能会无意中被阻止(即中国用户通过亚美尼亚的路线。或美国用户通过土耳其等)。

此外,这是相反的,如果有人真正想访问您的网站,他们可以代理。

You can utilize geolocation. http://www.geoplugin.com/webservices/php has a solid API which will give you a good set of information on a region based on the visitors IP address. Using this you can log access to a database and cut off regions after X amount of visitors or compare against a blacklist in a Database.

Be aware, proxying users may be inadvertantly blocked (I.e. China user routes via Armenia. Or US user through Turkey etc).

Additionally this works in reverse, if someone truly wants to visit your site they can proxy around.

浅唱ヾ落雨殇 2024-09-22 02:22:57

IP 地址; .htaccess 在这里帮不了你。 CogitoErgoSum 确定 IP 的地理位置。

IP addresses; .htaccess won't help you here. CogitoErgoSum nails the geolocation of IPs.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文