Support » Fixing WordPress » https and css

  • Resolved joekillbill

    (@joekillbill)


    Hello,

    I just install wordpress 4.9.2 and access it through nginx.

    Everything is ok whern I install and access it through HTTP.

    When I activate HTTPS on my nginx + on WordPress by customizing WP_HOME, WP_SITEURL and by setting FORCE_SSL_ADMIN to true, I can access to the website but all css links are blocked because they link to http://mysite.com instead of https://mysite.com.

    Does anyone have an idea of what is going weong?

    Thank you,
    Joan

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • you need to update all css,js and media file path with https and update all url in database with like
    http://mysite.com to https://mysite.com

    Moderator Steve Stern

    (@sterndata)

    Support Team Volunteer

    Use the plugin “better search replace” to do the replacement suggested above.

    Ok, thank you to both of you.

    I did that and I don’t know if it works or not because I’m falling into a problem I’ve already seen before and is probably at a higher level. Actually, my wordpress server is not the same than my nginx one (please find my config at the end of this message). Then, when I switch into HTTPS and I try to connect (https://mariage.herisson-soula.fr/wp-login.php), I am forwarded to https://mywordpress.local/wp-login.php, which fails.

    Thank you for your help,
    Joan

    ## nginx.conf ##

        server {
            listen 443 ssl;
            server_name mariage.herisson-soula.fr;
    
            ssl on;
            ssl_certificate XXX;
            ssl_certificate_key XXX;
            add_header XXX;
            ...
    
            location / {
                    proxy_pass      http://mywordpress.local;
            }
    
       }

    • This reply was modified 1 year, 4 months ago by  Steve Stern.

    Hello,

    ok I figured out the local forwarding. I am now on front of the following message when I installed and try to reach wp-login.php: “The page isn’t redirecting properly”.

    Logs on WP show 16 attemps to this page before showing this message on the browser.

    Anyone has an idea about what’s going on?

    Thank you,
    Joan

    Hi there,

    the problem of infinite redirections is solved just by adding the following lines in nginx.conf:

    map $http_x_forwarded_proto $thescheme {
    default $scheme;
    https https;
    }
    proxy_set_header X-Forwarded-Proto $thescheme;

    The following instruction already there in the wp-config.php do the trick:

    if (isset($_SERVER[‘HTTP_X_FORWARDED_PROTO’]) && $_SERVER[‘HTTP_X_FORWARDED_PROTO’] === ‘https’) {
    $_SERVER[‘HTTPS’] = ‘on’;
    }

    No need to add extra “define(anythingelse)” nor modify database URLs.

    Best,
    Joan

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘https and css’ is closed to new replies.