Help with: RewriteRule ^/(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

I have my HAProxy working to route my to the correct server, but I want to rewrite the header so it will point to the www version of the domain and its not working. Does the RewriteRule work in a ssl VirtualHost:

<IfModule mod_ssl.c>
	<VirtualHost *:443>
		ServerAdmin webmaster@localhost

		DocumentRoot /var/www/kohanyim/html
		#ServerAlias *

		# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
		# error, crit, alert, emerg.
		# It is also possible to configure the loglevel for particular
		# modules, e.g.
		#LogLevel info ssl:warn

		ErrorLog ${APACHE_LOG_DIR}/error-kohanyim-ssl.log
		CustomLog ${APACHE_LOG_DIR}/access-kohanyim-ssl.log combined

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^/(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


or what is the best (solution or rule) to use or should both use the same DocumentRoot (if you can)?

I tried this How to redirect URL with HAProxy with the Expression: Custom acl with no success:

redirect prefix code 301 if { hdr(host) -i }

I believe I have found the solution after further over looking the Actions section using,
Action > Table > Action customaction: redirect prefix

but not sure if this is a fix all? I’m going to need the request uri portion to make this complete. How would I make this,

RewriteRule ^/(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]


I did the test to see if it would carry over the url request path and it worked:

so I’m assuming I will not need additional parameters.