大网数据广告活动
服务器运维问答

Location Based URL Redirection in AWS

· 52CE 我爱测

How would I approach doing a URL redirection that has the following effect: Website: example.com If users come from an Indian IP address: example.com -> india.example.com

问题原文

原帖链接 · peso · CC BY-SA 3.0

How would I approach doing a URL redirection that has the following effect:

Website: example.com

If users come from an Indian IP address: example.com -> india.example.com

社区高分解答

原帖链接 · Tim · CC BY-SA 3.0

Route53 with location based routing would be the typical way to handle location based things. It won't change request domains, but it will route requests to the nearest region.

To achieve that you want, CloudFront can add a header that says where the query is coming from. Based on that you can have a web server do a redirect. Documentation is here.

Using Lambda@Edge you can redirect users to a country specific URL (solution provided by Michael in the comments). More info here.

Next option is to subscribe to a geolocation database. Use a PHP script to decide on location based on source IP and forward accordingly.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-10-15)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。