AWS ELB: redirect WordPress to HTTPS

With healthy.html on Health check

cat /var/www/html/.htaccess

# BEGIN WordPress

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{REQUEST_URI} !^/healthy\.html$
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

cat /var/www/html/wp-config.php

...
define('WP_HOME','https://www.example.com');
define('WP_SITEURL','https://www.example.com');

/** Detect if SSL is used. This is required since we are terminating SSL either on CloudFront or on ELB */
if (($_SERVER['HTTP_CLOUDFRONT_FORWARDED_PROTO'] == 'https') OR ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))
{$_SERVER['HTTPS']='on';}

AWS ELB: redirect WordPress to HTTPS