3

I have a domain through godaddy (www.example.com) and it is hosted on a different server. I also have a static aboutus page that I have in an S3 bucket. How do I link my aboutus page to the main website so that it has a URL of www.example.com/aboutus? What changes should I make in my DNS settings?

1
  • 2
    The DNS does not work at the URL level. With both https://www.example.com/ and https://www.example.com/aboutus the DNS is involved in exactly the same way, just to resolve www.example.com to some IP addresses. It is then the webserver at this IP address that has to generate the content based on the full URL. So it is a matter of configuring your webserver, maybe with a redirect or a proxy, to fetch the specific page from elsewhere. Feb 27, 2020 at 23:02

2 Answers 2

1

It is not possible to use DNS to point different pages on the same host name at different servers. All the documents on www.example.com have to be served from the same server. DNS can only point www.example.com to one IP address. It can't be split up based on pages.

There are however, some things you can do instead.

Use a subdomain

If you want to host some content on a separate server such as an S3 bucket, you could create a subdomain for that separate server. Subdomains are separate host names for DNS. You can point subdomains to different host names using DNS.

For example you could create the subdomain s3.example.com and point it to the S3 bucket. Then the URL of your "about us" page would be http://s3.example.com/aboutus.

If the "about us" page were the only thing in the S3 bucket, you could name the file index.html in the S3 bucket and point the subdomain about-us.example.com to the S3 bucket. Then the URL for the page would be http://about-us.example.com/.

Use a reverse proxy

Your main web server could run a reverse proxy to dynamically fetch documents from the S3 bucket and re-serve them itself. It is very common to use a reverse proxy to assign paths on the main domain to content run on different servers or different port numbers.

A reverse proxy is a great solution when the servers are on the same local network. When the two servers are geographically distant, using a reverse proxy can make those requests significantly slower.

For example if your main server is running Apache with mod_rewrite and mod_proxy enabled, you could use this configuration to reverse proxy the page:

RewriteRule ^/?about-us http://s3.example.us-west.amazonaws.com/about-us [P]

Then the URL of the page would be http://www.example.com/about-us

0

I would recommend you check out Netlify for hosting static sites because they have a generous free tier and static sites are their primary focus.

In AWS Console

  1. Create a bucket
  2. Name a bucket to be your domain name for easy setup.
  3. Go to bucket properties
  4. Go to edit bucket policy
  5. In text editor, edit a resource key with your domain name after ::
  6. Go to static web hosting
  7. Enable a web hosting option
  8. There is an endpoint link which is used to point your bucket to the domain

In GoDaddy Console

  1. Go to manage DNS
  2. Point CNAME of www to endpoint you received from the AWS console

🎉🎉🎉 🥂

Reference: https://www.youtube.com/watch?v=zzNlwGaccs4

1
  • The OP said he already has a website on a server, but just only one page is in a S3 bucket. So the question is not just how to host a whole website in an S3 bucket. Feb 27, 2020 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.