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,我接受它(基於重寫規則中的'#')? –