'Godaddy URL redirect from HTTP to HTTPS
I host my website on heroku and bought the domain from godaddy, here's how I set my DNS records
Records
A - @ - Forwaded - 600 secs
CNAME - www - example.com.herokudns.com - 1 Hour
Forwarding
-- Domain --
Redirect to https://www.example.com
-- Subdomain --
example.com Redirect to https://www.example.com
www.example.com Redirect to https://www.example.com
Expected Behaviour
When I enter example.com or www.example.com, it should redirect to https://www.example.com
Result
Only example.com got redirected to https://www.example.com, www.example.com does not
What went wrong with my configuration ?
Solution 1:[1]
You can't have www as a CNAME and also www as a redirect. If you have the www CNAME aliased to example.com.herokudns.com it's going to go directly to your app on Heroku and make a connection. Your app must be the one to force the redirect to https
at that point. I don't know what language you are using, but if it's Rails then set config.force_ssl = true
in production.rb
.
Solution 2:[2]
- The CNAME record on Godaddy should be "www." instead of "www"
- You should have only one redirect: example.com Redirect to https://www.example.com , and remove the other one.
Then you will probably have to allow quite a few hours for DNS changes to propagate, and it should work.
I have a similar configuation that works fine like this on a heroku Hobby plan (payed dyno) cf my recent post: SSL in Heroku with a custom domain
Solution 3:[3]
To actually use the Domain as the Web Address: The A Record should be the IP Address The CNAME only needs to be name: www value: @
Also I like to keep the TTL the same for the A and CNAME records. Wait about an hour before testing to ensure the servers have propagated.
For Domain forwarding you only need to scroll down to Forwarding and select https or http (make sure that is correct). Then the web address/url to the home page.
Use a permanent redirect for SEO.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Chloe |
Solution 2 | Guillaume Bihet |
Solution 3 | Ryan Duer |