htaccess force https not working if there is an URI

I’ve never worked with Apache, so I’m a completely newbie.

I have a multihosting account on a provider website, where 3 domain are used. I want to force https connection on a domain, let’s say, which is not the main domain of the hosting plan. What I did is to add an .htaccess file in the path examplecom/public_html, the folder where there are all the file of the website. In the .htaccess I have copy-pasted this strings from the provider guide:

RewriteEngine on RewriteBase / RewriteCond %{HTTPS} !on RewriteRule (.*){REQUEST_URI} [L,R=301] 

The website works correctly if I go to a page with an non-empty URI, but it doesn’t on the main page. In example: is correctly redirected to, while is redirected to, and can’t understand why.