I have an amazon S3 bucket serving a website from S3bucketurl.com/foo/index.html.
I would like to configure a redirection rule, that automatically rewrite the URL as follows:
Accessing S3bucketurl.com should automatically redirect to S3bucketurl.com/foo, and serve the index.html file contained in the subfolder foo.
I tried to set up the Redirection Rule as such:
<RoutingRules>
<RoutingRule>
<Condition>
<KeyPrefixEquals>/</KeyPrefixEquals>
</Condition>
<Redirect>
<ReplaceKeyWith>api</ReplaceKeyWith>
</Redirect>
</RoutingRule>
</RoutingRules>
which results in a 404:
404 Not Found
Code: NoSuchKey
Message: The specified key does not exist.
Key: index.html
I've also tried permutations of <ReplaceKeyWith>/api</ReplaceKeyWith>, <ReplaceKeyWith>api/</ReplaceKeyWith> and <ReplaceKeyWith>/api/</ReplaceKeyWith> to no avail.