I am trying to get an S3 bucket when it encounters a 404 rather than throwing up a 404 page it redirects to my own server so I can then do something with the error.
This is what I have cobbled together, what I think it should do is go to mydomain.com and hit the error.php and let the php script workout the filename the user was trying to access on S3.
I would like this to happen no matter what directory the request comes from. When I have an error document defined in website hosting the 404 page shows up and when I don't have a 404 page defined I get an access denied xml error.
This is my current redirection rule
<RoutingRules>
<RoutingRule>
<Condition>
<HttpErrorCodeReturnedEquals>404</HttpErrorCodeReturnedEquals>
</Condition>
<Redirect>
<HostName>www.mydomain.com</HostName>
<ReplaceKeyPrefixWith>error.php#!/</ReplaceKeyPrefixWith>
</Redirect>
</RoutingRule>
</RoutingRules>
Can anyone give me a hint as to what I am missing please?