Moodle v2.7 installation gives “this webpage has a redirect loop” error.
The Problem
Extracts from Apache access log /var/log/apache2/access.log
:
[...] "GET /admin/index.php?sessionstarted=1&lang=en HTTP/1.1" 303 903 [...] "GET /admin/index.php?cache=1 HTTP/1.1" 303 941 [...] "GET /admin/index.php?sessionstarted=1&lang=en HTTP/1.1" 303 903 [...] "GET /admin/index.php?cache=1 HTTP/1.1" 303 941 [...] "GET /admin/index.php?sessionstarted=1&lang=en HTTP/1.1" 303 903 [...] "GET /admin/index.php?cache=1 HTTP/1.1" 303 941
The Fix (Ubuntu 14.04 with Apache2)
Find out the moodle dataroot directory:
# grep ">dataroot.*=" /var/www/html/moodle/config.php $CFG->dataroot = '/var/lib/moodle-data';
And remove all content:
# rm /var/lib/moodle-data/* -Rf
Reload a web-browser.
Thanks a lot! Just saved me from a big head overheat :) .
I’m glad it helped :)
Thanks Tomas it worked for me, can you throw some light on why this happened?
I never got to the bottom of this problem, but as dataroot contained “cache”, “localcache”, “session” and “temp” directories, this must have been something related with the server’s cache.
$CFG->dataroot contains both cache and uploaded files. Deleting the whole content of the data directory could be a bit too aggressive.
Thanks. Default Moodle installation has no uploaded files I worry about.
Thank you.
Worked on my moodle, had already tried several things without success, including debug the code, it went into loop and I could not solve. But your solution solved.
Welcome!
Find the moodledata folder. Inside the moodledata there are many folders
1. Delete all from Cache
2. Delete all from Session
Restart your browser.
It worked for me. Hope that works for you.
http://stackoverflow.com/a/25116078
thank you! this worked
Thank you, it worked for me, too
this is the correct answer for a windows installation with same error. Thanks!
what do i have to delete in config.php file???
You do not have to delete anything in the config.php file.
Thanks works for me on moodle v3 also.
Thanks – saved me hours of debuggin.
Welcome.
OMG!!! I REALLY LOVE U MAN!
it works for moodle 3.2
Thanks you very much
You’re welcome!