$CFG->alternateloginurl = 'https://url.com'; not working.

Re: $CFG->alternateloginurl = 'https://url.com'; not working.

by Ken Task -
Number of replies: 0
Picture of Particularly helpful Moodlers

My suggestion, I think, is the path of least resistance (ie, no coding)
and can be done in the Admin UX to the site - given your criteria of being able to login to Moodle (just admins) if the SSO isn't working.

So *you* (as the admin) will have 2 logins to Moodle ... 1 using credentials from your SSO system, and 1 that's in 'Moodlese' authenticates as 'manual'.   They are not the same.   Only admins and other persons that might deal with higher levels than student level *might* need 2 accounts ... 1 SSO and 1 manual.

https://docs.moodle.org/310/en/Managing_authentication
That says ... in section entitled ...
Alternate login URL

You may configure an alternate login URL for your site and set this to an absolute URL or to a relative URL. If it is set as a relative URL, it will be assumed as relative to $CFG->wwwroot. For example, your $CFG->wwwroot is set to http://example.com/moodle and your $CFG->alternateloginurl is set to /alternate/login.php. The absolute URL of the alternate login URL is assumed to be in http://example.com/moodle/alternate/login.php.

This should be used with care, since a mistake in the URL or on the actual login page can lock you out of your site. If you do mess it up, you can remove the entry alternateloginurl from your database (table mdl_config) using, e.g., phpmyadmin for mysql. Depending on your configuration, you will also have to clear your caches with php admin/cli/purge_caches.php. You can read some more useful information about changing $CFG->alternateloginurl = ' your url '; on the following discussion

Discussion URL:
https://moodle.org/mod/forum/discuss.php?d=86952

https://docs.moodle.org/310/en/Authentication_FAQ
That says ...
How can I change the "Is this your first time here?" instructions?

See the section 'Is this your first time here?' instructions in Managing authentication.

My suggest is to add the link to this alternate page (or where ever folks use the SSO sign in) in the 'instructions' box of the original login page - again *no coding required* ... just a link to the SSO sign in page ... which I assume is on another server ... at a different URL.

Comment out alternateloginurl line in config.php (this is the only 'coding')
by placing a // in front of that line.  Reason for commenting out ... in case you change your mind.

'SoS', Ken