I have some conflicts setting my DNS records on Namecheap To get my website served with SSL.
On Heroku I defined both www.domain.com and domain.com and received target1 and target2 respectively from Heroku.
On Namecheap I've set:
CNAME record - name: www - target: target1.
CNAME record - name: @ - target: target2.
url redirect record - name: @ - target: https://www.domain.com
Currently both www.domain.com and domain.com point to non SSL page.
I played plenty with these records but I can't seem to get it right.
At some point I managed to have domain.com point to SSL but not www.domain.com.
Usually when you need to redirect from non-SSL to SSL, you have to do that in the application. This is not a DNS change. Name cheap may claim that they have this type of redirect, but it is best to do the redirect on the site itself. This is easy to do if you have a web server like Apache or NGINX in front of your app, but you could very well have this check in your application itself and redirect if it's not SSL.
I editted now the .htaccess with these lines:
And it magically works.
Can someone with more experience comment on this, I want to make sure I'm not doing something wrong.
This comment was deleted 5 years ago