I’m currently using functions.php to redirect http urls to https for a site which currently has no SSL certificate:

Using file config.php

define('WP_HOME','https://'.$_SERVER['HTTP_HOST'].'/');
define('WP_SITEURL','https://'.$_SERVER['HTTP_HOST'].'/');

Redirect non-www to www in .htaccess

Using file .htaccess

Change your configuration to this (add a slash):

RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Or the solution outlined below, will work for any domain:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# Redirect HTTPS to HTTP
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

If you need to support http and https and preserve the protocol choice try the following:

RewriteRule ^login\$ https://www.%{HTTP_HOST}/login [R=301,L]

Where you replace login with checkout.php or whatever URL you need to support HTTPS on.