Configuring your Moodle site to use SSL

moodleFor some Moodle sites, you'll want them to use SSL, so that all the traffic on the site is encrypted.  Particularly important if the site is used for financial transactions.

This article describes how to do this using the Siteground SSL Certificate, using the example of


Before you get started, please note that you need to have the exact sub-domain as a symlink or a folder inside of the primary domain folder (for the SSL).

In order to do that, you can create the symlink by running the following command through SSH in the folder: /home/Addons/ where the domain for the SSL resides.

ln -s /home/Subdomains/ secure

Note that if you are unsure how to create this symlink you can post a new ticket at Siteground and they will do it for you (for other sub-domains you wish to use through the secure connection).

Note, that adding a symlink, does not affect the Akeeba Backup on In other words the symlinked /secure folder is not included when backing up using Akeeba Backup in the primary domain folder.


Moodle sites

  1. Navigate to the config.php file in the File manager.
  2. Look for the line 17 (on default config files) that shows:
$CFG->wwwroot = '';

Change the http:// to https:// like the following:

$CFG->wwwroot = '';

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

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$$1 [R,L]


Thanks for visiting.