Solving SSL Issues with Moodle

I manage a Moodle website and recently had the following SSL issue. Below I describe it and how it was solved in hopes that if you have the same problem, it may help you.

I installed an SSL certificate on my Moodle site (servantsclass.com) that is hosted on Bluehost. When that happened, there were two problems.

First, the SSL showed as insecure. I used GTMetrix.com and it showed me that the logo and background image were being pulled up as HTTP, not https which were required.

The second problem was that the SSL certificate only worked on the login page. And this was after I had gone to Site Administration > Security > HTTPS security and turned on Use HTTPS for logins.

The two problems I wanted to be solved were 1) Make the background image and logo to show up without messing up the SSL certificate. They had to be pulled as https. 2) Make the SSL certificate to show up well on all pages, not just the login page.

I didn’t know how to go about it, so I went to upwork.com and hired Mir Ayman Ali from Bangladesh to help me. He did a good job and helped me do the following two things that solved the problem.

1. Modify the config.php

Simply edited config.php and changed http:// to https:// in $CFG->wwwroot.

2. Create a .htacess and add following code to it.

In the Bluehost File Manager, I went to the public_html and then clicked on the truthclass folder and opened it. I then went to the top of the file manager and clicked “New File” and named the new file .htacess. Note that there wasn’t already a .htaccess file in this folder. We created a new one for it. Before this time, I wasn’t aware that you can simply create a new .htaccess file. That was a learning moment for me.

After creating the .htaccess file, I added the following code from the moodle.org docs. (https://docs.moodle.org/33/en/Transitioning_to_HTTPS )

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

That code was the only thing I added to the blank .htaccess file I created. There were no explanations or anything else put into this brand new file. Note that in the code, where you see servantsclass.com, you change and put your own website.

The above two steps fixed the problem completely. I hope you find this helpful to you.

Here is a link to a Bluehost page that shows you how to create a .htaccess file. Scroll down to the section, “On the server”.

 

 

Get My FREE eBook!
Learn how to achieve your dreams in my FREE e-book! Plus receive fresh content from my blog. Six Simpe Steps ebook cover
I respect your privacy. I don't spam!
FREE eBook!
Learn how to discern God's calling on your life! Sign up for this FREE eBook and get our blog content straight to your inbox as well. Preparingtodiscerngodscalllarge2
We respect your privacy. We don't spam.