Redirect loop - locked out of Moodle 2.5 after enabling 'My Moodle'

Redirect loop - locked out of Moodle 2.5 after enabling 'My Moodle'

Matt Long -
回帖数:12

Hi all,

We just installed a Moodle 2.5 Beta site for testing (we're currently using Moodle 1.9x on our production site). I've been doing configuration on the site, and this morning I enabled 'My Moodle' in Settings->Site Administration->Appearance->Navigation.

Now, any user that tries to log in gets a 'This webpage has a redirect loop' message and can't go any further. I've tested in all major browsers with different user accounts. We have a Windows 2008 R2 server, MySQL 5.5, Apache 2.2 and PHP 5.3.

Can someone tell me where to look in the database to revert this setting? I'd rather not have to rebuild the site from scratch if it can be avoided. It seems like a bug--maybe this only happens on Windows-based servers?

Sorry if this issue has been addressed already in the forums--I didn't see it when searching. Thanks for your help!

Regards,
Matt

回复Matt Long

Re: Redirect loop - locked out of Moodle 2.5 after enabling 'My Moodle'

Matt Long -

Okay, fixed it by adding this line to config.php (found it here:https://tracker.moodle.org/browse/MDL-35082).

$CFG->defaulthomepage = 0; // 0 = site, 1 = My Moodle, 2 = User preference

It still seems like a bug since I'm not able to use MyMoodle at all without the redirect loop occuring. We would like to use it on our site, so any thoughts/input are welcome. Thanks!

Matt

回复Matt Long

Re: Redirect loop - locked out of Moodle 2.5 after enabling 'My Moodle'

Ric Morte -

Hi, I too get this error - not on the production server but on a local WAMP server.

Everything was OK in Moodle 2.4.3.

WAMP:
  MySQL: 5.5.24
  Apache: 2.2.22
  PHP: 5.3.13

All browsers. Tried your fix - made no difference. Might have to revert to 2.4.3 and upgrade to 2.4.4.

Ric

回复Ric Morte

Re: Redirect loop - locked out of Moodle 2.5 after enabling 'My Moodle'

Matt Long -

Hi Ric,

You could try the change below directly in the database (also from the tracker link above). As always, you'll have to restart Apache after making any changes. Also, I started a tracker for this particular bug a few weeks ago. It seems to affect the 2.5 stable version as well: https://tracker.moodle.org/browse/MDL-39429

 

HTH,

Matt

 

(comment from the above bug report/tracker)
Dallas Ray added a comment - 27/Aug/12 11:07 PM

Not sure if this will help but I went into the database and noticed that in mdl_config, the field navshowmycoursecategories was set to 1

I tried switching it to 0 and then the site began running normally again.

 

回复Matt Long

Re: Redirect loop - locked out of Moodle 2.5 after enabling 'My Moodle'

Ric Morte -

Hi,

After a bit of sleuthing I have narrowed the error down to a single file and, within that file, two significant changes. The file concerned is /moodle/muc/config.php

In moodle 2.4.4 we have at lines 50 and 51:

      'mode' => 4,
      'store' => 'default_request',

In moodle 2.5.0 we have at lines 50 and 51:

      'mode' => 1,
      'store' => 'default_application',

Further down..

In moodle 2.4.4 we have at lines 62 and 63:

      'mode' => 1,
      'store' => 'default_application',

In moodle 2.5.0 we have at lines 62 and 63:

      'mode' => 4,
      'store' => 'default_request',

Summarising: the two instances have been swapped round between the two versions. This may be correct coding but reverting to the 2.4.4 version avoids the endless redirection error on my WAMP server. I must reiterate that on the live production server for 2.5.0 no such redirection takes place.

No idea what modemappings are but maybe this makes sense to someone out there...?

Ric

PS: the cache directories for the two versions are very different. The different structure for 2.5.0 does not appear to be the cause of the problem.

回复Matt Long

Re: Redirect loop - locked out of Moodle 2.5 after enabling 'My Moodle'

venus muduli -

There is simple away to get out from this problem.

Just delete the contents  moodledata folder and refresh the webpage it will work fine.

It's tested and working well.No need to change any codebase.



回复Matt Long

Re: Redirect loop - locked out of Moodle 2.5 after enabling 'My Moodle'

Barakatullah Khan -

Mr. KEN has posted the solution :

here : https://moodle.org/mod/forum/discuss.php?d=229591#p1064209

@ all ...

I've had this happen but only a couple of times.  When something like that happens, have found it's best NOT to panic and close down the browser, but, rather, use the URL line of the browser and erase the ending of the URL up to admin/ (right to left).  Hit enter key and found Moodle was attempting to direct me to some setting screen.   Saved.  And everything ok after good.

Have had to do this once on a stubborn server ...

http://server/admin/purgecaches.php

and it continued so physically removed the contents of:

/moodledata/cache/cachestore_file/default_application

which is what the purgecaches.php script was to do.

At that point, cleared the browser cookies and cache.

Then attempted to login again.  Finally, success.

One cravat ... none of the servers I work on are on shared hosting (cheapo plan).

'spirit of sharing', Ken

 ;

回复Barakatullah Khan

Re: Redirect loop - locked out of Moodle 2.5 after enabling 'My Moodle'

Nguyễn Văn Tuyên -

This is all the answer to those who have the problem of re direct loop. Thank you very much for your help, Mr. Ken and barakatullah Amir Pathan

:Have had to do this once on a stubborn server ...

http://server/admin/purgecaches.php

and it continued so physically removed the contents of:

/moodledata/cache/cachestore_file/default_application

which is what the purgecaches.php script was to do.

At that point, cleared the browser cookies and cache.

Then attempted to login again.  Finally, success."

 

BTW, if you run it on local host, just navigate to "/moodledata/cache/cachestore_file/default_application" and delete all the contents in it. It perfectly works with this error.

回复Matt Long

Re: Redirect loop - locked out of Moodle 2.5 after enabling 'My Moodle'

Abbas Ahmadi -

I had the same problem with my Moodle 2.6 running under ubuntu 13.10 server. I tried all of the solutions mentioned in this forum, but with no success. Finally I have solved the problem by adding the following line to config.php at /var/www/moodle folder:

$CFG->sessioncookies='eCDQAP';

the 'eCDQAP' can be any string for your site.

I have also modified the following configuration paraeters for the db:

$CFG->dboptions = array (

       'dbpersist' => false,

       'dbport' => '80',

      'dbsocket' => true,

);

Then I restarted the apache2 web server by issuing the following command at ubuntu command prompt:

sudo service apache2 restart

Now it works like  a charm.

In summary it is s session cookie problem

 

 

 

 

 

 

回复Abbas Ahmadi

Re: Redirect loop - locked out of Moodle 2.5 after enabling 'My Moodle'

Ken Task -
Particularly helpful Moodlers的头像

DB Port 80????!!!!   Wouldn't that set up a conflict of services running on port 80 cause that's the default port for apache/web servers.

'spirit of sharing', Ken

回复Matt Long

Re: Redirect loop - locked out of Moodle 2.5 after enabling 'My Moodle'

venus muduli -

There is simple away to get out from this problem.

Just delete the contents  moodledata folder and refresh the webpage it will work fine.

It's tested and working well.No need to change any codebase.



回复venus muduli

Re: Redirect loop - locked out of Moodle 2.5 after enabling 'My Moodle'

Floyd Saner -

@venus:  Delete the moodledata folder??  On the server??  No!  This will totally trash all files, backups, data, etc. from the Moodle site.  

This type of redirection is usually caused by assigning an alternate login url in the Manage Authentication settings, or invalid session data.  See the other solutions referenced above.

Floyd