I've installed a ssl cert on a site and it's working. Now I want to redirect visitors coming in on http over to https

I've put this code and only this code in the htaccess file, but it's causing a redirect loop.

    <IfModule mod_rewrite.c>
	RewriteEngine On
	
	RewriteCond %{SERVER_PORT} 80 
	RewriteRule ^(.*)$ https://www.mysite.com/$1 [R,L]

	</IfModule>

My original htaccess looked like this:

    <IfModule mod_rewrite.c>
	RewriteEngine On
	
	RewriteCond %{HTTP_HOST} ^mysite.com [NC]
	RewriteRule ^(.*)$ https://www.mysite.com/$1 [L,R=301]

	# Send would-be 404 requests to Craft
	RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
	RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
	RewriteRule (.+) index.php?p=$1 [QSA,L]
	</IfModule>

Could Craft somehow be causing the redirect loop?

In the Craft CP I have the Site URL set to https://www.mysite.com