0
I am trying to redirect a url, example.io, to www.example.org/survey/imagine.
Currently, my S3 bucket handles redirection with the following redirection rules:
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<HostName>www.example.org</HostName>
<ReplaceKeyPrefixWith>survey/imagine</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>403</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<HostName>www.example.org</HostName>
<ReplaceKeyPrefixWith>survey/imagine</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
</RoutingRules>
My issue is when I add any prefix to example.io, that prefix is appended to the url of the destination.
Examples:
example.io/something
redirects to www.example.org/survey/imaginesomething
example.io/blah
redirects to www.example.org/survey/imagineblah
example.io/blah/there
redirects to www.example.org/survey/imagineblah/there
Desired Result:
example.io/something
redirects to www.example.org/survey/imagine
example.io/blah
redirects to www.example.org/survey/imagine
example.io/blah/there
redirects to www.example.org/survey/imagine
I am using CloudFront to handle the DNS services and distribution of example.io. In CloudFront for example.io, I have an invalidation with the object path /*
. I have a behavior with path pattern /*
, which should redirect all requests for example.io/*
, where *
is a wildcard, to the example.io s3 bucket endpoint.