I am struggling with an issue for a long time still I don't have a proper solution. The scenario is as follows:
<strong>Domain Name:</strong> domain-name.com
<strong>Website Desired URL:</strong> <a href="https://www.domain-name.com/" rel="nofollow noreferrer">https://www.domain-name.com/</a>
<strong>Type of Website:</strong> Wordpress
<strong>Web Hosting:</strong> AWS
<strong>DNS Management:</strong> Route53
<strong>SSL:</strong> From AWS Certificate Manager attached with Load Balancer
I tried several ways to do that but didn't work, some of them are as follows:
<strong>Case 1:</strong>
At Route 53 I set bare domain A record with load balancer alias and a CNAME record for www.domain-name.com with value domain-name.com
Website URL at wordpress: <a href="https://www.domain-name.com" rel="nofollow noreferrer">https://www.domain-name.com</a>
Result: This website has too many redirections and the website failed to load
<strong>Case 2:</strong>
At Route 53 I set bare domain and www.domain-name.com both A record with load balancer alias
Website URL at wordpress: <a href="https://www.domain-name.com" rel="nofollow noreferrer">https://www.domain-name.com</a>
At htaccess, I set 301 redirect to https from http
Result: I found my website working but it had multiple redirects such as if I request a URL with <a href="http://domain-name" rel="nofollow noreferrer">http://domain-name</a> it took me to <a href="http://www.domain-name" rel="nofollow noreferrer">http://www.domain-name</a> then again redirected to <a href="https://www.domain-name" rel="nofollow noreferrer">https://www.domain-name</a>
<strong>Case 3:</strong>
I kept everything same as in case 2 except I changed A record for bare domain to a S3 bucket which had static web hosting enabled and forwarded all the request to www.domain-name but it didn't resolve the multiple redirection issue. I also tried setting up a CloudFront which uses above S3 bucket and updated the A record of the bare domain with the cloudfront alias.
Kindky help me with the correct setting at each level from Route 53 to Load Balancer setting to htaccess to achieve the above in a standard way.
Thanks
<strong>Domain Name:</strong> domain-name.com
<strong>Website Desired URL:</strong> <a href="https://www.domain-name.com/" rel="nofollow noreferrer">https://www.domain-name.com/</a>
<strong>Type of Website:</strong> Wordpress
<strong>Web Hosting:</strong> AWS
<strong>DNS Management:</strong> Route53
<strong>SSL:</strong> From AWS Certificate Manager attached with Load Balancer
I tried several ways to do that but didn't work, some of them are as follows:
<strong>Case 1:</strong>
At Route 53 I set bare domain A record with load balancer alias and a CNAME record for www.domain-name.com with value domain-name.com
Website URL at wordpress: <a href="https://www.domain-name.com" rel="nofollow noreferrer">https://www.domain-name.com</a>
Result: This website has too many redirections and the website failed to load
<strong>Case 2:</strong>
At Route 53 I set bare domain and www.domain-name.com both A record with load balancer alias
Website URL at wordpress: <a href="https://www.domain-name.com" rel="nofollow noreferrer">https://www.domain-name.com</a>
At htaccess, I set 301 redirect to https from http
Result: I found my website working but it had multiple redirects such as if I request a URL with <a href="http://domain-name" rel="nofollow noreferrer">http://domain-name</a> it took me to <a href="http://www.domain-name" rel="nofollow noreferrer">http://www.domain-name</a> then again redirected to <a href="https://www.domain-name" rel="nofollow noreferrer">https://www.domain-name</a>
<strong>Case 3:</strong>
I kept everything same as in case 2 except I changed A record for bare domain to a S3 bucket which had static web hosting enabled and forwarded all the request to www.domain-name but it didn't resolve the multiple redirection issue. I also tried setting up a CloudFront which uses above S3 bucket and updated the A record of the bare domain with the cloudfront alias.
Kindky help me with the correct setting at each level from Route 53 to Load Balancer setting to htaccess to achieve the above in a standard way.
Thanks