htaccess file


I am new to Drupal and I am not familiar with htaccess files. I am using D8 and I have the following problem. I bought an SSL certificate for my domain and when I access the site typing the url is being redirected to , but the url unfortunately is not. So I read online that I need to redirect the www traffic to nonwww. I found this post but it is an old one and not quite what I am looking for
However, I understood that I need to edit the .htaccess file
So I went to my htaccess file and saw this:

# To redirect all users to access the site WITHOUT the ‘www.’ prefix,
# ( will be redirected to
# uncomment the following:
# RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
# RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]

I removed the hashtags in the last two sentences but it made no difference.
I guess it didn’t work because maybe I need to add the name of my domain but I don’t know exactly where without breaking this code.
Can somebody help please?

Drupal version: