Many web masters prefer to redirect non-www request to www. There are lots of different approaches for that and most famous one is using 301 redirection on the web server to handle this redirect part. Then what happen is, server must need to put extra processing for this redirection request. If the server have to handle thousands of request, it would not be efficient method at all. If your domain NS (name servers) is hosted with AWS Route53, you can use their own proprietary alias “record” to solve this problem. The traditional DNS, you cannot do it at all and you have to used 301 redirect instead as I mentioned earlier. Other advantage of the redirection is SEO improvement as some search engine recognize www and non-www as two different web sites and this cause to penalize the domain considering website has duplicate content.
Here I’m going to demonstrate how to redirect non-www requests to www using AWS Route 53. So let’s look at.
1) create S3 bucket for naked domain
2) Configure non-www request to www on AWS S3
i) Highlight previously created bucket
ii) From “Properties” expand “Static Website Hosting”
iii) Select “Redirect all request to another host name”
3) Configure AWS Route53
i) select your domain from “hosted zones”
ii) point www to your server ip or ELB (Elastic Load Balancer) by creating new records
you may click on “Create Record Set” button
iii) select your naked domain record from the list
list may contains other records such MX, TXT as well, but you must select just your domain.
when you select it, you can set following parameters from right hand side panel.
select Type as “A – IPV4 address” from drop down
select Alia as “YES”
select Alias Target as previously created S3 bucket from drop down.
that’s how to do that. Comment here If you are having any question at all !