in wp-config:
define('WP_HOME','https://mywebsite.com');
define('WP_SITEURL','https://mywebsite.com');
$_SERVER['HTTPS'] = 'on';

https://stackoverflow.com/questions/29478863/too-many-redirects-after-switching-wordpress-to-https