I have followed the AWS documentation to setup a simple static website:
mydomain.com
-> contains the website filesmydomain.com
with https (redirect http to https)www.mydomain.com
-> redirects to mydomain.com
Now, I have a second static site, which is independent of the main site. However I want to host it under mydomain.com/myproject/
.
Currently I just copy the files for myproject
into the same bucket in the folder /myproject/
, but I was wondering if it would be feasible to have a separate bucket for myproject
and redirect the URL to that bucket instead.
Could this be done and if so, how?
Yes, that can be done by having two behaviors in your CloudFront distribution, one mapping /* to the origin s3://mydomain.com and /myproject/* to the origin s3://myproject.
Also, you can have both names as alternate CNAMEs for the distribution and use Route 53 ALIAS for them.