CSS and scripts not loading over https - Is this related to url rewrites?

Hi, I’ve been researching this for a couple of hours and so far I’ve tried the following:

  • changed http to https in wp-config.php (see below)
  • changed option_values in database for siteurl and home from http to https
  • commented out url rewrites in lib/config.php like so: //add_theme_support(‘rewrites’);

I’m using the stripe plugin with woocommerce and I desperately need css and jquery properly loaded on my checkout page which is served over https. The console gives “insecure content” errors preventing css, jquery and other plugin assets from being loaded properly.

Thanks in advance for any roots-theme related guidance on this issue.

wp-config.php:

  • define(‘WP_SITEURL’, ‘https://’ . $_SERVER[‘SERVER_NAME’] . ‘/wp’);
  • define(‘WP_HOME’, ‘https://’ . $_SERVER[‘SERVER_NAME’]);
  • define(‘WP_CONTENT_DIR’, $_SERVER[‘DOCUMENT_ROOT’] . ‘/wp-content’);
  • define(‘WP_CONTENT_URL’, ‘https://’ . $_SERVER[‘SERVER_NAME’] . ‘/wp-content’);

@jeff you may want to look at this issue comment. It may address the same issue you are having.

@talves Thanks for the suggestion. Based on that code I was able to replace https with http for RELATIVE_PLUGIN_PATH and RELATIVE_CONTENT_PATH so now at least the https path for my stylesheet works.

However, there is something going on that all of my plugin scripts still have http urls, not https.

The main plugin I’m trying to get to work over https is woocommerce. As a test, I hardcoded the full https path for the $woocommerce->plugin_url() function. This variable and the rest below are all showing up with https.

echo $home_url;                  // https://www.mydomain.com
echo $woocommerce->plugin_url(); // https://www.mydomain.com/wp-content/plugins/woocommerce
echo WP_PLUGIN_URL;              // https://www.mydomain.com/wp-content/plugins
echo RELATIVE_PLUGIN_PATH;      // https://www.mydomain.com/wp-content/plugins
echo RELATIVE_CONTENT_PATH;     // https://www.mydomain.com/wp-content
echo THEME_PATH;                // https://www.mydomain.com/wp-content/themes/roots
echo WP_SITEURL;                // https://www.mydomain.com/wp
echo WP_HOME;                   // https://www.mydomain.com
echo WP_CONTENT_URL;            // https://www.mydomain.com/wp-content

When I go into the page source, all of the plugin scripts from below the footer have http paths which result in the insecure content warnings in both chrome and firefox.

My two primary suspects now are wp_footer() and something about the way grunt spits out minified javascript files.

I don’t know much at all about grunt or minification.

As far as wp_footer() goes, I assume it just takes the url paths as they are declared in the wp_register_script() functions in which case, I think I took care of that by hardcoding the $woocommerce->plugin_url().

Anyone have any other ideas?

I’d greatly appreciate any other guidance.

Edit: In retrospect, I’m not sure grunt has anything to do with the paths for the minified js files in my plugins directory.