You need to have your webserver listening on port 443, and be properly configured
Don't be trying to do this in the .htaccess
Here's how I do all my sites (with Apache):
https://antipaucity.com/2017/07/07/ssl-configuration-for-apache-2-4-on-centos-7-with-lets-encrypt/
Be sure mod_ssl is installed
March 28, 2020 at 08:34AM
via reddit https://www.reddit.com/r/Wordpress/comments/fqj3fg/is_there_anything_wrong_in_the_code_for_301/flql6ih?utm_source=ifttt