Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cant login to my wp-admin after switching to SSL

Tags:

php

ssl

wordpress

I recently installed SSL certificate for my wordpress site(http to https) and now I'm unable to access Wordpress Admin. It refreshes the page and I am not logged in.

Is there something I forgot to change in my wordpress files?

I inspected the code and the login form is pointing to my old site (the http one) and when I look at the code in the file, the form action is set to site_url() and I can't seem to find where it's defined.

like image 938
user1269625 Avatar asked Mar 06 '13 03:03

user1269625


1 Answers

I have used this first:

i have

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

still not able to fix and nothing happened.

Then I used

define('WP_HOME','https://example.com');
define('WP_SITEURL','https://example.com');

and I was able to connect to wp with https.

Now I have only minor issues of conflict (mixed https/http content on my page) but most things work.

Thank you!

like image 170
Arianna Avatar answered Oct 04 '22 21:10

Arianna