Redirect http to https in htaccess file

What would be the correct way to redirect to https? Find these two ways:

RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

o

RewriteCond  %{SERVER_PORT} ^80$
RewriteRule  ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

Which one would be correct?