I wanted to install an SSL certificate for my personal website.
After reading some recommends, I registered on Cloudflare, add my website, and activate the free scheme.
Make it flexible to use http or https when visiting the website.
I tried http and https URLs, both addresses work for the single blog article page.
Can’t Login wp-admin Due To Https Redirect
Then I changed site address and WordPress address, made them start with https
like this.
The bad response showed in my browser, I can’t log in WordPress panel anymore.
The fear I can’t manage my site became stronger in my heart as the time pass.
I believe Cloudflare did its job without mistake.
That must be my fault, I set a few options wrongly for my wp-admin.
I got some cue on StackOverflow, and checked my database.
The relevant commands are in the following section.
mysql -u root -p
show databases
use wordpress
show tables;
SELECT * FROM wp_options WHERE option_name='siteurl' OR option_name='home';
Maybe the transform from http to https is too early, or I miss something on the panel.
Anyway, I reset it to HTTP and tried again. Everything is fine.
update wp_options set option_value = 'https://www.weiy.city' where option_name = 'home';
update wp_options set option_value = 'https://www.weiy.city' where option_name = 'siteurl';
Install SSL Certificate
Cloudflare supports generating certificate, we can copy it and upload to server.
We would get private key and certificate file (pem).
Save all data and put both files in the website root directory, such as /home/wwwroot/default
.
# ls weiy.city*
weiy.city.key weiy.city.pem
The rest jobs are easy to be done if we install the plugin Really Simple SSL.
It will help us to check our SSL certificate and configure our website for https transform.
Relevant link:
https://dash.cloudflare.com
[…] Upload old files weiy.city.pem and weiy.city.key to the website root directory. Relevant article: WordPress – Wp-admin Https Redirect And Install SSL Certificate […]
[…] https://www.weiy.city/2019/07/wordpress-wp-admin-https-redirect-and-install-ssl-certificate/ . […]