JohnP Good catch. @AleM are you using nginx? Then you can’t use a htaccess file. That’d be Apache.
And I know even less about nginx so all I can do personally to help you is suggest you start Google searching.
A theory I have would be that you currently have a www version of your website plus a non-www version. You have attempted to fix that with redirects in an Apache htaccess file. But, that may not help you depending on your set up.
Sounds like you mostly know this or else you wouldn’t be trying to redirect in the first place, so as you know, your SEO will not be good if you don’t permanently redirect to either the www or non-www.
A final tip you may take or not take if you ever use Cloudflare: At some point my web host said if you are using Cloudflare, it’s best to stick with the www version. I don’t know why. I’m not that technical. And it could be just my web host due to their set up. But, since then because I always utilize Cloudflare, I permanently redirect to the www version. Plus, for a little bit of nostalgia, I like the www version since that’s how everyone once had their web addresses shown. 😄
Maybe this will help you. I didn’t full read the posts and I don’t know anything about nginx. But serverfault.com looks like a good place to figure this out.
Hide www: https://serverfault.com/questions/258378/remove-www-and-redirect-to-https-with-nginx
Keep www:
https://serverfault.com/questions/624848/redirect-non-www-to-www-over-ssl-with-nginx