Forced HTTP to HTTPS Redirection

I am trying to force users from http:// to https://. HTTPS Auto Setup was run correctly and both the encrypted and unencrypted connections work when manually typing them in.

My steps that should have worked using a mod_rewrite for Apache did not work. Created /etc/httpd/conf.d/https_redirect.conf and restarted httpd. Code as follows:

# Redirect all requests to port 80 to port 443 SSL via mod_rewrite
# make sure the module is loaded and switched on
<IfModule !mod_rewrite.c>
LoadModule rewrite_module /usr/lib/httpd/modules/
<IfModule mod_rewrite.c>
RewriteEngine on
# The line below sets the rewrite condition for
ReWriteCond %{SERVER_PORT} !^443$
# redirect rule
ReWriteRule ^(.*) https://%{HTTP_HOST}/$1 [NC,R,L]

you could try an .htaccess file in /var/www/html

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R,L]