The version is WordPress 5.3.2.
Add this to your .htaccess file, at the very top.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
The fix has worked. But why hasn’t it done this before? I’ve have had to add that code to the .htaccess file on other non-Worpdress websites I’ve built in the past. I never thought I’d need it for WordPress.
dunno. I always do this for SSL sites.
Is anyone else having the same issue?
I always add the SSL code to my .htaccess file as well.
The fix has worked. But why hasn’t it done this before? I’ve have had to add that code to the .htaccess file on other non-Worpdress websites I’ve built in the past. I never thought I’d need it for WordPress.
It hasn’t done it because that’s the way it’s supposed to work. “It’s not an issue, it’s a feature”. 🙂
Most browsers, when you type say “example.com” will first go to
http://example.com
then try
http://www.example.com
Only then giving up and returning an error if there’s nothing there.
If you want visitors to be redirected to httpS:// – you must do it “manually”, .htaccess rule being a nice and practical way for that.
Should WordPress do that automatically when you set its address to https://example.com?
That would take some thinking and consideration. Depending on one’s setup, it could create problems to some people, some of the time. Here’s one example (not related to https, but nonetheless):
https://stackoverflow.com/questions/9924987/how-to-stop-sub-directory-inheriting-parents-htaccess-rules
The way it’s implemented now with WordPress (ie. no automatic .htaccess edits related to redirections to https): it is all under user’s control, though it requires some action on their part.
I wrote more on redirects in a blog post, primarily for my own future reference when fixing problems:
https://io.bikegremlin.com/5561/optimization-02-redirects/
Thanks for the info.
I also noticed that multisite installations aren’t affected.
I think there is mixed content errors caused by content served insecurely in the latest version.