Looks like your htaccess file is not enabled mod rewrite rule at present, try un-commenting line LoadModule rewrite_module modules/mod_rewrite.so
once. Plus go through article https://phoenixnap.com/kb/how-to-set-up-enable-htaccess-apache for understanding on how to enable htaccess file.
Also change your rules to following.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(?:www.)?(.*)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…