False redirect after upgrading to 3.11

False redirect after upgrading to 3.11

by Jan Meinert -
Number of replies: 2

I'm running a Moodle site on undervisning.net-akademiet.dk.

I have just upgraded from 3.8 to 3.11, and am now automatically re-directed from undervisning.net-akademiet.dk to https://www.net-akademiet.dk/undervisning.net-akademiet.dk, which of course generates a 404 error message.

Why is that ... and how to repair?

Average of ratings: -
In reply to Jan Meinert

Re: False redirect after upgrading to 3.11

by Leon Stringer -
Picture of Core developers Picture of Particularly helpful Moodlers

So your Moodle site's URL is https://undervisning.net-akademiet.dk and this works as expected.

But if you try to access it at http://undervisning.net-akademiet.dk (HTTP not HTTPS) you get redirected to the non-existent URL.

I would guess that this is something Apache is configured to do. If you manage the server try to find the Apache .conf file that's listening on port 80 for this domain name, for example:

<VirtualHost *:80>
    ServerName undervisning.net-akademiet.dk
    ⋮

and look for a redirect rule, normally RewriteCond and RewriteRule.

If you manage the site via a web interface hopefully you can find the configuration setting for the non-HTTPS site.

I don't think this is something in Moodle that changed during the upgrade. Let's Encrypt has a script to install certificates which optionally adds a redirect so it's possibly something this has done.

In reply to Jan Meinert

Re: False redirect after upgrading to 3.11

by Ken Task -
Picture of Particularly helpful Moodlers

Dunno why it happened ... might have to do with how you upgraded.

but ... look at the config.php file for the moodle site.

$CFG->wwwroot = '

Should be the url to your site - without www stuff.

I just accessed and it doesn't redirect!

Suggest clearing browser cache and cookies ... and if you have ssh into server execute from cli purge all caches ..

or see if you can go directly to via URL:

https://yoursite/admin/purgecaches.php

'SoS', Ken