Como Forzar De http a https Con htaccess

A continuación dejamos el código el cual debe ir en la carpeta raíz en el archivo htaccess, con el fin de redirigir automáticamente de http a https. Código: A https sin www RewriteEngine OnRewriteCond %{HTTPS} off [OR]RewriteCond %{HTTP_HOST} ^www\. [NC]RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]