I recently got bit by this scenario. Using a theme, had it working under HTTP, and when I went to switch HTTPS on I was disappointed to see the pages broken. Sadface…
I tried the usual steps. The first thing I did was to look at the wp_options in the database and change thechange the SITE_URL and HOMEPAGE options. I found that my wp-config.php had HTTP hardcoded like this:
define(‘WP_HOME’,’http://example.com’);
define(‘WP_SITEURL’,’http://example.com’);
So I commented out those 2 lines. Still no luck. Well at this point I started getting frustrated, which usually means I start digging through source code. This time was not an exception. In my functions.php I found that all the wp-content links were using get_template_directory_uri():
define( ‘NEWFASHION_WPO_THEME_URI’, get_template_directory_uri() );
…used, for example, like…
wp_enqueue_script(‘newfashion-base_bootstrap_js’,NEWFASHION_WPO_THEME_URI.’/js/bootstrap.min.js’);
Ah ha! I thought excitedly. It must be the get_template_directory_uri function, which in fact checks the server variable to see if HTTPS is set to on.
The end solution, since I’m using a load balancer that is setting these other headers, was to copy the solution from the article linked above into my wp-config.php file.
if (isset($_SERVER[‘HTTP_X_FORWARDED_PROTO’]) && $_SERVER[‘HTTP_X_FORWARDED_PROTO’] == ‘https’)
$_SERVER[‘HTTPS’] = ‘on’;