Bill Osuch
Bill Osuch

Reputation: 408

Problems redirecting http to https in htaccess

I'm working on converting a WordPress site to https, and I'm having problems doing an automatic redirect in htaccess. I can get the home page to redirect, but nothing else. I'm using:

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://selfreliantschool.com/$1 [R=301,L]

And I've also tried:

RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://selfreliantschool.com/$1 [R=301,L]

But neither work on anything but the home page. Here's the home page: http://selfreliantschool.com, and here's another page: http://selfreliantschool.com/christmas-gift-bootcamp/. First works, second doesn't. Any suggestions?

Upvotes: 2

Views: 74

Answers (4)

Bill Osuch
Bill Osuch

Reputation: 408

Gave up on the htaccess route and installed a plugin (Really Simple SSL) that fixed the redirect issue.

Upvotes: 1

Bridget Arrington
Bridget Arrington

Reputation: 444

Check your URL in General -> Settings. If that does not work, look in your wp-config file to see if the home and siteurl are being overwritten.

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

Upvotes: 1

PJ Doland
PJ Doland

Reputation: 56

Try this:

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

Upvotes: 1

Colin Gell
Colin Gell

Reputation: 382

I would download your SQL file and do a find and replace for http to https

You can do this in a code editor such as Notepad++ or Sublime where you can use the shortcuts Ctrl + H

Then just drop the original SQL table and insert the edited one.

But do take a backup first - Other people may have a different solution, and only do the above if you feel confident

Upvotes: 0

Related Questions