skip to Main Content

Let’s say I have B.example.com. B is dead, meaning when I try to go to that subdomain, I get 404. I want to redirect all requests from B.example.com to A.example.com, which is a fully working subdomain. This is all hosted on AWS.

I tried the following:

-created S3 bucket called B.example.com, enabled public access

-made it a static website hosting bucket, with Redirect Requests to A.example.comm, protocol https

-created a new record under example.com domain called B

-chose A type, IPv4, simple routing policy

-enabled Alias, picked my s3 bucket as the endpoint, and saved it

-tried going to B.example.com, it just times out now

I feel like there is an easier way to go about this. This was provided by ChatGPT. Tried it, didn’t work. Help welcome, thanks.

2

Answers


  1. Look at your DNS, can you just update your A subdomain to point to your B subdomain and then configure the application on B to perform the redirect?

    If not you probably need to use CloudFront & S3 static sites(updating your DNS to cloudfrount + setup a certificate in ACM) if your apps are using HTTPS as S3 static sites do not support HTTP. See https://repost.aws/knowledge-center/cloudfront-redirect-domain

    Login or Signup to reply.
  2. You should use CNAME records for that purpose, which routes traffic to another domain name.

    Hosted zone name that you should edit will be example.com

    The final Records format should be

    Record name / Type / Alias / Value/ Route traffic to

    A.example.com / C / No / B.example.com

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search