Redirect to subdomain not working when specifying http scheme

I’ve recently uploaded a website on a domain. Using the domain registrar (NameCheap) I’ve also applied a 301 redirect rule so that going to "@" (for example example.com) will redirect to www.example.com.

However, I noticed that if I specify the http scheme like so – http://example.com I get redirected to https://example.com, and get an ERR_CONNECTION_REFUSED error.

What’s the reason for that and how can it be fixed? Am I doing some things wrong?

I’ll mention that at first the 301 rule did not work when I specified to go to https://www.example.com, and only after replacing the https with regular http did it work (although when visiting the site, I still see in the URL that it is in fact using https).