• nerdburglars

    (@nerdburglars)


    I have spent a lot of time to get to this, but i have found that when the server variable $_SERVER[‘HTTPS’] = “on”; the website will not load. I get no errors in the php log and the server response is 200, so i have no idea what is causing it not to load

    I am trying to force ssl on the admin/login page. When HTTPS is missing the page loads fine. By missing i mean the key HTTPS does not exist in the server variable. The problem is that all of the css/js files are loading over http and because of this they do not load at all because the url is https.

    I have been able to fix the css and js not loading issue by adding the following code to index.php

    ob_start();
    define(‘WP_USE_THEMES’, true);
    require( dirname( __FILE__ ) . ‘/wp-blog-header.php’ );
    $content = str_replace(“http:”, “https:”, ob_get_clean());

    This works great, but it doesnt seem to work on the admin page.

    I have already setup a redirect in my htaccess file that will redirect to https, which is working and i have updated the site url variables to have https in the config file and in the DB.

    define(‘WP_HOME’,’https://site.com’);
    define(‘WP_SITEURL’,’https://site.com’);

    Im not sure if it matters, but im running a multisite.

  • The topic ‘WordPress not loading when https is enabled’ is closed to new replies.