amazon-web-serviceshttp-redirectdnsrecordcname

CNAME in Route 53 redirect to subfolder of domain


I have a domain zyx.com and I would like to point it to the page in abc.com/cba. Is there a way in Route 53 to do this with either a CNAME or A record? Both of the domains are on AWS, but when I do a CNAME record pointing zyx.com to abc.com/cba, zyx.com points to abc.com instead of the subfolder of the domain.

Thank you in advance.

I created a CNAME record pointing zyx.com to abc.com/cba. I also created an A record for the same. Either way it does not take


Solution

  • You cannot use DNS to redirect to a specific page on the same domain or any other domain. Redirects occur within HTTP, not DNS.

    Instead, on AWS, you can use an S3 bucket with static web hosting to configure a redirect. To redirect requests for a bucket website endpoint:

    1. Open the Amazon S3 console at https://console.aws.amazon.com/s3/.

    2. Under Buckets, choose the name of the bucket that you want to redirect requests from (for example, www.example.com).

    3. Choose Properties. 4.Under Static website hosting, choose Edit.

    4. Choose Redirect requests for an object.

    5. In the Host name box, enter the website endpoint for your bucket or your custom domain. For example, if you are redirecting to a root domain address, you would enter example.com.

    6. For Protocol, choose the protocol for the redirected requests (none, http, or https). If you do not specify a protocol, the default option is none.

    7. Choose Save changes.

    For more details, refer to the docs.