johnniexo88
johnniexo88

Reputation: 313

WordPress NOT redirecting from http to https SSL

I have my WordPress Address (URL) and my Site Address in the WordPress settings as my url: https://example.com/blog but when I type in http://example.com/blog, it doesn't redirect it to the SSL version, even though I have the site address as https.

I disabled all the plugins and switched to the default theme but this still occurs. Any reasons as to why this is happening or solutions?

Upvotes: 0

Views: 3992

Answers (2)

Dana
Dana

Reputation: 372

You forgot to update .htaccess file after installing SSL. So you should add the following code to your .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

After that, for cross-checking regarding your website all pages are properly redirected to https or not, follow steps & use tools mentioned in this resource.

Upvotes: 1

Justin Waulters
Justin Waulters

Reputation: 303

You still have to redirect 'http' to 'https'.

You have several options, here are a couple:

Option 1

In your .htaccess file you can add:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]

Just be sure to change www.example.com to whatever your domain should be (you don't need the www. if you don't want it.)

Option 2

Change your DNS to CloudFlare (free) and change the settings according to this: https://support.cloudflare.com/hc/en-us/articles/200170536-How-do-I-redirect-all-visitors-to-HTTPS-SSL-

However, if you want to use www. I recommend using two page rules so that you can redirect http to https and add www. in a single redirect. Doing both in a single redirect can be better for SEO. For both page rules, select the setting called "Forwarding URL" and "301" and make the rules as follows:

http://*example.com/*

to

https://www.example.com/$2

and

https://*example.com/*

to

https://www.example.com/$2

This is assuming that you are not using subdomains. If you are, let me know and I can update the answer with rules that will accommodate subdomains.

Upvotes: 1

Related Questions