How to use HTTPS in Moodle site

Category: | Tag:

Follow the below steps...

1. Login to your Moodle site and go to Site Administrator > Security > HTTP security

2. Tick Use HTTPS for logins and Secure cookies only

3. Now edit your config.php as show below

From
$CFG->wwwroot = 'http://www.yoursite.com';
T0
$CFG->wwwroot = 'https://www.yoursite.com';

and, add this line if not already there

$CFG->sslproxy=true;

4. Next, Set up a redirect in your .htaccess file. Place the following code to force the https:// redirect.

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

Save the .htaccess file.

Copyright © 2025 Siam Naulak.
magnifiercrossmenu