• nerdburglars

    (@nerdburglars)


    My site loads fine under http, but when i setup the ssl cert and visit the home page there is no CSS loaded. When i look at the console the browser is blocking all JS and CSS files due to Mixed Content errors.

    How do i fix this? I was always able to make this work in the past by changing the following

    define(‘WP_HOME’, ‘https://’ . $web_site_url);
    define(‘WP_SITEURL’,’https://’ . $web_site_url);

    This doesnt work though. All of the dynamic links and stuff have https in front of them, but all of the external css and javascript files are screwing up.

    What is causing this? I cant rely on a plugin to do this for me, I dont want to be loading more processing work on my site. This is surely a simple issue to fix

Viewing 5 replies - 1 through 5 (of 5 total)
  • Dan Poynor

    (@danpoynor)

    Maybe check your themes function.php and header.php file to see if https:// is used and change to https:// or even just //.

    Thread Starter nerdburglars

    (@nerdburglars)

    The theme seems ok, its the core WP files and all of the plugin files too, this is controlled by the WP core and not the theme right?

    the enque scripts hook isnt writing anything as https. This means even jquery, dashicons etc arent loading.

    Dan Poynor

    (@danpoynor)

    Besides the define statements, you might try changing the home and site urls in the database in the wp_options table.

    linux4me2

    (@linux4me2)

    Have you tried leaving the defines you list in the original post out of wp-config.php and setting both the WordPress Address and Site Address in Settings -> General to https://yourdomain.com?

    If that alone doesn’t fix it, try adding the following to the functions.php of your theme/child theme:

    define('FORCE_SSL_ADMIN', true);

    The combination of those two things has always worked for me, though you’re going to need to verify that none of the CSS or JS is hard-coded in your theme or your theme’s functions.php to use HTTP.

    Once you get that working, you’re going to need to change all the URLs in your post_content table to use HTTPS, as well as any that appear in text widgets.

    @linux4me2 Thanks for the code snippet. That functions.php line did the trick! Much thanks ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Cant get CSS and JS files to load with HTTPS’ is closed to new replies.