I use an AWS Cloudfront + S3 solution to host my website.
I redirect all naked domain and vanilla HTTP requests to the prefix https://www.example.com.
The following S3 Cloudfront Architecture cartoon captures my approach:
In addition to the existing logic, I would like to also redirect a single page, namely:
https://www.example.com/category/coins/
to
https://www.example.com/cat/coins.html
I tried to do this via the S3 buckets redirect rules and received a 301 redirect to the bucket address, and not the cloudfront endpoint.
e.g.
http://www.example.com.s3-website-us-east-1.amazonaws.com/cat/coins.html
How can I correctly redirect this particular page?
AWS provides documentation on how to redirect with CloudFront and that are Viewer Request Functions.
S3 also has documentation on how to do redirects based on different hosts