June 06, 2020, 10:12:34 AM
collapse

* Site Menu

Author Topic: How To Force HTTP to HTTPS  (Read 5107 times)

0 Members and 1 Guest are viewing this topic.

Offline Skhilled

  • Administrator
  • Hero Member
  • *
  • Posts: 3373
  • Attack: 34
    Defense: 43
    Attack Member
  • Gender: Male
  • Retro Gamer!
    • Buildz Hosting
How To Force HTTP to HTTPS
« on: May 05, 2017, 09:03:53 AM »
First, you must have a SSL certificate installed! I highly suggest Let's Encrypt...it's free!!! If your hosting does not already have it installed ask them to install it.

https://letsencrypt.org/

Even if you have a SSL installed, you and your visitors can still view the HTTP part of your site. To prevent this you can create a .htaccess file and put it in your root directory where your domain resides. You should add the following code to it:

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

If you already have a .htaccess file you'll want to add ONLY the 2nd and 3rd lines directly after the first instance of:

Code: [Select]
RewriteEngine On
This will force all pages of your site to use HTTPS instead of HTTP.  O0

Offline Ken.

  • Vietnam Era Veteran
  • DS VIP
  • Hero Member
  • *
  • Posts: 694
  • Attack: 100
    Defense: 100
    Attack Member
  • Gender: Male
  • TP Rocks
    • Our FamilyForum
Re: How To Force HTTP to HTTPS
« Reply #1 on: May 06, 2017, 07:00:57 AM »
How do we determine if our host has the SSL certificate is installed?
" If everything seems under control, you’re not going fast enough." - Mario Andretti

Offline Skhilled

  • Administrator
  • Hero Member
  • *
  • Posts: 3373
  • Attack: 34
    Defense: 43
    Attack Member
  • Gender: Male
  • Retro Gamer!
    • Buildz Hosting
Re: How To Force HTTP to HTTPS
« Reply #2 on: May 06, 2017, 07:16:42 AM »
Look in cPanel. It should be somewhere near the SSL icon.

Offline Ken.

  • Vietnam Era Veteran
  • DS VIP
  • Hero Member
  • *
  • Posts: 694
  • Attack: 100
    Defense: 100
    Attack Member
  • Gender: Male
  • TP Rocks
    • Our FamilyForum
Re: How To Force HTTP to HTTPS
« Reply #3 on: May 06, 2017, 07:37:33 AM »
Look in cPanel. It should be somewhere near the SSL icon.

Got it. ;D
" If everything seems under control, you’re not going fast enough." - Mario Andretti

Offline Ken.

  • Vietnam Era Veteran
  • DS VIP
  • Hero Member
  • *
  • Posts: 694
  • Attack: 100
    Defense: 100
    Attack Member
  • Gender: Male
  • TP Rocks
    • Our FamilyForum
Re: How To Force HTTP to HTTPS
« Reply #4 on: May 06, 2017, 07:44:07 AM »
Getting ready to add the code to my .htaccess file now.
" If everything seems under control, you’re not going fast enough." - Mario Andretti

Offline Skhilled

  • Administrator
  • Hero Member
  • *
  • Posts: 3373
  • Attack: 34
    Defense: 43
    Attack Member
  • Gender: Male
  • Retro Gamer!
    • Buildz Hosting
Re: How To Force HTTP to HTTPS
« Reply #5 on: May 06, 2017, 07:45:05 AM »
Great!  O0

Offline Ken.

  • Vietnam Era Veteran
  • DS VIP
  • Hero Member
  • *
  • Posts: 694
  • Attack: 100
    Defense: 100
    Attack Member
  • Gender: Male
  • TP Rocks
    • Our FamilyForum
Re: How To Force HTTP to HTTPS
« Reply #6 on: May 06, 2017, 07:58:15 AM »
Quick and easy!
Thanks for this new and useful tip Steve.  :happy:
" If everything seems under control, you’re not going fast enough." - Mario Andretti

Offline Skhilled

  • Administrator
  • Hero Member
  • *
  • Posts: 3373
  • Attack: 34
    Defense: 43
    Attack Member
  • Gender: Male
  • Retro Gamer!
    • Buildz Hosting
Re: How To Force HTTP to HTTPS
« Reply #7 on: May 06, 2017, 04:52:19 PM »
Remember, that images, etc. may be linked from elsewhere that is not using secured SSL. Also, images should be hosted on the same server.

I found this modified version of repair_settings.php and change all links to https! I found the code fix on SMF:

https://www.simplemachines.org/community/index.php?topic=550197.msg3901127#msg3901127

EDIT: Almost forgot... They are working on a newer version of repair_settings.php and v2.0.14 which should address these things...hopefully. Not sure when it'll be released.

Offline Skhilled

  • Administrator
  • Hero Member
  • *
  • Posts: 3373
  • Attack: 34
    Defense: 43
    Attack Member
  • Gender: Male
  • Retro Gamer!
    • Buildz Hosting
Re: How To Force HTTP to HTTPS
« Reply #8 on: May 07, 2017, 09:36:23 AM »
Yup! I think the modified repair_settings.php did the trick. But, it does help if you do not use an external "unsecured" server for images or files! They show make it so you will not see the green lock and saying the site is secured.


EDIT: Here's how to check your site to see if it's SSL and if there are any errors:


https://www.jitbit.com/sslcheck/


EDIT: A little more info...and I'll make a class on it or something later so all of this info is in one place...


While working on Ken's forum, I noticed that mods and links to them will make pages show as unsecured. If a mod has embedded unsecured links it will show as unsecured. If any links to the mod, such as a gallery, that contains unsecured links embedded in the code or even the link to the creator or the mod's site is unsecured all pages with links to or from the mod will show as unsecured.
« Last Edit: May 07, 2017, 07:08:02 PM by Skhilled »

Offline Ken.

  • Vietnam Era Veteran
  • DS VIP
  • Hero Member
  • *
  • Posts: 694
  • Attack: 100
    Defense: 100
    Attack Member
  • Gender: Male
  • TP Rocks
    • Our FamilyForum
Re: How To Force HTTP to HTTPS
« Reply #9 on: May 07, 2017, 09:40:18 PM »
This process seems to be a bit of a can of worms because of the external links that we have on our sites, especially externally linked images.
" If everything seems under control, you’re not going fast enough." - Mario Andretti

Offline Skhilled

  • Administrator
  • Hero Member
  • *
  • Posts: 3373
  • Attack: 34
    Defense: 43
    Attack Member
  • Gender: Male
  • Retro Gamer!
    • Buildz Hosting
Re: How To Force HTTP to HTTPS
« Reply #10 on: May 08, 2017, 06:19:05 AM »
That depends on how you've been doing things on your site. It can be a bit of a process, actually a PITA, for some more than others. But seems to be a necessary evil, atm.

Offline Skhilled

  • Administrator
  • Hero Member
  • *
  • Posts: 3373
  • Attack: 34
    Defense: 43
    Attack Member
  • Gender: Male
  • Retro Gamer!
    • Buildz Hosting
Re: How To Force HTTP to HTTPS
« Reply #11 on: May 10, 2017, 09:02:50 AM »
I've found a little known setting that may also help. In the admin, under Cookies and Sessions enable:

Quote
Force cookies to be secure
(This only applies if you are using HTTPS - don't use otherwise!)

I've enabled it here...

Offline Ken.

  • Vietnam Era Veteran
  • DS VIP
  • Hero Member
  • *
  • Posts: 694
  • Attack: 100
    Defense: 100
    Attack Member
  • Gender: Male
  • TP Rocks
    • Our FamilyForum
Re: How To Force HTTP to HTTPS
« Reply #12 on: May 10, 2017, 11:00:36 AM »
Good find Steve, lets hope that it helps.
" If everything seems under control, you’re not going fast enough." - Mario Andretti

Offline davejo

  • DS User
  • Not So New
  • *
  • Posts: 38
  • Attack: 100
    Defense: 100
    Attack Member
  • Gender: Male
    • www.davejohnson.co.uk
Re: How To Force HTTP to HTTPS
« Reply #13 on: June 08, 2017, 08:08:27 AM »


I just did a long post here with 4 very small png attachments and an error came back and said that it couldn't accept anymore attachment as the folder was full.

As you don't have the 'Draft' mod installed I've lost it all now

Offline Skhilled

  • Administrator
  • Hero Member
  • *
  • Posts: 3373
  • Attack: 34
    Defense: 43
    Attack Member
  • Gender: Male
  • Retro Gamer!
    • Buildz Hosting
Re: How To Force HTTP to HTTPS
« Reply #14 on: June 08, 2017, 08:33:18 AM »
Sorry, Dave! I haven't checked that setting in quite a few years. Last time I checked I probably didn't have a lot of disk space for the hosting at that time. It is fixed.


EDIT: I've tried to install the drafts mod but get an error when trying to use it. I've uninstalled it and will look more into it this weekend.
« Last Edit: June 08, 2017, 09:10:55 AM by Skhilled »

 

Page created in 0.11 seconds with 25 queries.