Moderator
Jan Dembowski
(@jdembowski)
Forum Moderator and Brute Squad
Redirect from http to https should be automatic?
It should be automatic but not all things are perfect.
Try this: make a backup of your site’s database and files (backups are your friend).
https://codex.ww.wp.xz.cn/WordPress_Backups
Then treat your site as if it moved from one URL to the other. In this case it’s http://www.mydomain.com to https://www.mydomain.com (http to https).
https://codex.ww.wp.xz.cn/Moving_WordPress#Changing_Your_Domain_Name_and_URLs
After all of the old references are changed to the new one (with https) then the redirect should just work. If something goes wrong then restore the database and you’ll be back to where you were before you tried to make changes.
https://codex.ww.wp.xz.cn/Restoring_Your_Database_From_Backup
Thanks for the reply!
The site had already under WordPress Address and Site Address URL https://www.mydomain.com but when I type in the browser
mydomain.com it does not get redirected to https://www.mydomain.com
I even backed up and reinstalled WordPress and started installation process with https://www.mydomain.com and still no luck. Changed from https to http and then back to https and still no luck even tried with default Twenty Sixteen theme. What is causing to get stuck on http://www. ?
-
This reply was modified 9 years, 7 months ago by
JohnyBeGood.
-
This reply was modified 9 years, 7 months ago by
JohnyBeGood.
-
This reply was modified 9 years, 7 months ago by
JohnyBeGood.
There are two additional things I do to get HTTPS to work on a WordPress site when Jan’s recommendation doesn’t work:
- In your wp-config.php, add the following code:
define('FORCE_SSL_ADMIN', true);
- Add the following at the beginning of the .htaccess file in your root WordPress folder:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Ordinarily, setting those in addition to the HTTPS in site URL and Address in General Settings do the trick.
Thanks!
I did as suggested above and now when I go to here https://www.linksspy.com/seo-tools/free-seo-ssl-scan/ and enter mydomain.com under “Your domain”
I get this:
http://mydomain.com
There are the following errors for this URI:
#
description
1 http://mydomain.com/ redirects to https://www.mydomain.com/ through a redirect chain. This hurts your rankings
http://mydomain.com/ –>
https://mydomain.com/ –>
https://www.mydomain.com/
which means its bad for SEO.
I wouldn’t use the “www” subdomain in your site address or URL. It’s kind of a holdover from the old days when the web was new. Now it’s assumed that if you’re going to a domain, it’s a web site. Just use “https://yourdomain.com” for both the site and home settings as long as your SSL certificate supports it. Most SSL certs these days do. Test it again after making that change and you should be okay.
I just checked one of my SSL sites on linksspy.com, and it had no errors, so I think you can get there with the settings I suggested.
By the way, you’re going to need to make sure that all the links in your content, widgets, etc. as well as the src for images are set to HTTPS, or are protocol-neutral, too.
-
This reply was modified 9 years, 7 months ago by
linux4me2.
I got it to work! Thank you so much!
Since google.com gets still forwarded to https://www.google.com I’m following them for now 🙂
I did turn off auto redirect to www and in WordPress settings I already had https://www.mydomain.com
With your .htaccess suggestion I changed from:
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
to
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
now it gets redirected from mydomain.com to https://www.mydomain.com
And the best part is linksspy.com is not finding any errors!
All of my images are https and every link I visit I get green pad lock.
It still blows my mind why other domain I did not had to do any of this. It just works out of box.
Oh well, I’ve been trying to get this to work for days now and I’m glad its working.
Thanks again!
-
This reply was modified 9 years, 7 months ago by
JohnyBeGood. Reason: edit