The best way to do a redirect from HTTP to HTTPS site is to use the Redirect directive in the Apache virtual host configuration. If you have a site configured at https://sample.com
and if you want to redirect the http://sample.com
requests to the https site it can be achieved as follows:
References:
[1] https://wiki.apache.org/httpd/RewriteHTTPToHTTPS
[2] https://wiki.apache.org/httpd/RedirectSSL