0
有没有可能在S3中重定向?AWS S3重定向404子错误文件夹的规则
domain/us/wrongurl.html redirect to this ➜ domain/us/404.html
domain/uk/wrongurl.html redirect to this ➜ domain/uk/404.html
domain/wrongurl.html redirect to this ➜ domain/404.html
最接近的解决方案:
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals>US</KeyPrefixEquals>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<HostName>domain.name</HostName>
<ReplaceKeyPrefixWith>US/404.html#</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
</RoutingRules>
这就是它,虽然比赛应该是大小写敏感的,和(只是要迂腐)我把结尾的斜线上'美国/ KeyPrefixEquals>'以避免无意中匹配(如)'example.com/users'也有'us'(但不是'us /')作为前缀。您可能还需要根据存储桶配置测试代码403。你正在做某种SPA,我接受它(基于重写规则中的'#')? –