Installing and upgrading help

The page isn't redirecting properly with Fresh installation

 
Picture of Mohit Raj
The page isn't redirecting properly with Fresh installation
 

I installed fresh moodle 2.5+ on my localhost. It is installed successfully. But when i running it from my localhost browser the 'The page isn't redirecting properly' error is coming. can you suggest me how can i resolve this.

 
Average of ratings: -
Picture of the Beezelbarb
Re: The page isn't redirecting properly with Fresh installation
 

I'm having this same problem (I followed the directions from http://docs.moodle.org/24/en/Windows_installation_using_Git) and would love to know how get past the redirect error.

"This webpage has a redirect loop

The webpage at http://localhost/moodle/admin/index.php?cache=1 has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.

Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects."

I did try clearing cookies, and also tried opening it in Firefox rather than Chrome. Both produce the redirect error.

 
Average of ratings: -
Picture of Y A
Re: The page isn't redirecting properly with Fresh installation
 

Hi

I have the same problem. I used Wamp and Xampp on windows 7 enterprise 32 bit. I've done the following but nothing helped:

- Changed settings on Firefox to accept all cookies

- Deleted cache on Firefox

- Allow users full control of cache folder

Can this be an error of configuration in the server?

 

 

 
Average of ratings: -
Picture of Muhammad Usman
Re: The page isn't redirecting properly with Fresh installation
 

I have installed Moodle today and i am facing the same issue..can somebody suggest the solution..

 
Average of ratings: -
Picture of Muhammad Usman
Re: The page isn't redirecting properly with Fresh installation
 

So should i install previous stable version or try to reinstall it.

Also please mention how can i uninstall moodle, should i only delete the directory where start and stop scripts are located?

 
Average of ratings: -
Picture of Nam Nguyen Cong
Trả lời: Re: The page isn't redirecting properly with Fresh installation
 

Thank you, it really works for me, just only clear everything from moodledata folder

 
Average of ratings: -
Picture of Atif Azad
Re: Trả lời: Re: The page isn't redirecting properly with Fresh installation
 

i resolved the issue ....... smile just clean everything from moodle data folder

thanks Nam Nguyen Cong

 
Average of ratings: -
Picture of kanika pal
Re: The page isn't redirecting properly with Fresh installation
 
I too get "This webpage has a redirect loop" error. To solve this issue, I ake this following action: Delete all the data from moodledata folder, then try to open localhost/moodle in your browser. It works for me
 
Average of ratings: Useful (7)
Picture of Nicodemus Karisa
Re: The page isn't redirecting properly with Fresh installation
 

Kanika pall solution has worked for me too! Just Deleting all data from moodledata folder did all the magic!

 
Average of ratings: -
Software Engineer
Re: The page isn't redirecting properly with Fresh installation
 

Thank you so much Nicodemus Karisa you are saved my valuable time... it is a magic.. 

 
Average of ratings: -
Picture of chirdsak upanya
ตอบ: Re: The page isn't redirecting properly with Fresh installation
 
Thank you very much Nicodemus Karisa . I very try install and uninstall moodle about 20 times. 
 
Average of ratings: -
Picture of Michael Libron
Re: The page isn't redirecting properly with Fresh installation
 

Thank you very much. It works for me too...but sad, don't know already how to login in my localhost as seen in the attached photo. So damn to ask this, but need help. Just new to this thing, doing this for my thesis


 
Average of ratings: -
Picture of Raghupathi G
Re: The page isn't redirecting properly with Fresh installation
 
Hey Nicodemus Karisa, Its working fine, Thanks a ton 
 
Average of ratings: -
Picture of Gireesh Deepak R
Re: The page isn't redirecting properly with Fresh installation
 

Thanks Kanika pal, this worked for me

 
Average of ratings: -
Sachin Suryavanshi
Re: The page isn't redirecting properly with Fresh installation
 

Hi Kanika,


works for me.



Thanks,

sach

 
Average of ratings: -
Picture of Rajakumar Jillella
Re: The page isn't redirecting properly with Fresh installation
 
Hi Kanika Pal,


I also got the same issue, and followed your suggestion. It works for me.


Thanks..

 
Average of ratings: -
Picture of Mohammad Gholipour
Re: The page isn't redirecting properly with Fresh installation
 
thank's It is an excellent solution. 

I delete the "cache" folder and the problem was solved.

therefore it is not necessary to delete all data.

 
Average of ratings: Useful (1)
Picture of Didin Rosyadi
Re: The page isn't redirecting properly with Fresh installation
 

Thanks Mohammad Gholipour. It's work for me. 


I delete the "cache" folder and the problem was solved.

therefore it is not necessary to delete all data.


If i delete all data, localhost said error

 
Average of ratings: -
Picture of sasi kiran
Re: The page isn't redirecting properly with Fresh installation
 

It works for me -)

 
Average of ratings: -
Picture of Bangbang Ahmad
Re: The page isn't redirecting properly with Fresh installation
 
Average of ratings: -
Picture of Lloyd Estrada
Re: The page isn't redirecting properly with Fresh installation
 
TNX GOOD HELP for me!!!

cheers
 
Average of ratings: -
Picture of Alfonso Perez
Re: The page isn't redirecting properly with Fresh installation
 

Excellent, Issue solved... Using version: 30.0 in a Windows XAMPP

 
Average of ratings: -
Picture of praveen gubbala
Re: The page isn't redirecting properly with Fresh installation
 

thanks alot. your answer worked for me. I think this error is because of failed installation in the past. My last failed installation created moodle data folder with different values. successful installation is also keeping the data in the same folder. config.php file is confused with lot of redirections in the moodledata folder.

 
Average of ratings: -
Picture of Royson Dsouza
Re: The page isn't redirecting properly with Fresh installation
 

Perfectly worked for me with your solution. Thanks a ton

 
Average of ratings: -
Picture of Kiran babu Etukiri
Re: The page isn't redirecting properly with Fresh installation
 

Thak you so Much kanika pal. You really great.

 
Average of ratings: -
Picture of Naomi Quirke
Re: The page isn't redirecting properly with Fresh installation
 

Kanika's solution still works, 3 years later with Moodle 3.3.

THANKS THANKS THANKS

 
Average of ratings: -
Picture of Marios Kargas
Απάντηση: Re: The page isn't redirecting properly with Fresh installation
 

when I open http://localhost/moodle/?redirect=0 it works fine but when I go to start page as admin I find nothing( http://localhost/moodle/my/ ). Is this normal? Please help! 

 
Average of ratings: -
Picture of Vinay Khosla
Re: The page isn't redirecting properly with Fresh installation
 

Facing the same problem.. Anybody got a solution to this???

 
Average of ratings: -
Picture of Deborah Davidson
Re: The page isn't redirecting properly with Fresh installation
 

I'm having this problem too .... can any help????  Everything is installed and updated, etc but when I then to to website, the error message comes up.

 
Average of ratings: -
Gmads
Re: The page isn't redirecting properly with Fresh installation
 

Hi Deborah,

You might want to adjust the date of your calendar,

 

 
Average of ratings: -
Picture of Deborah Davidson
Re: The page isn't redirecting properly with Fresh installation
 

Have checked that out but it's all set out as it should be ... However, I have uninstalled 2.5 and installed 2.4.4 instead and it works - not without a couple of issues which need addressing, so  I think the problem is within the 2.5 download ....

 

 
Average of ratings: -
Tijgertim
Re: The page isn't redirecting properly with Fresh installation
 

This problem still exists in Moodle 3.x.

I have found that by removing all references after the base URL (e.g. moodle.example.com/login/... etc. becomes just plain moodle.example.com) and attempting to login again usually solves the problem. It has something to do with the session registry ("Your session has expired") but I'm fiddled if I'm going to clean out the cache or Moodledata serverside each time this happens (or set up a CRONjob to keep cleaning out...).

My main concern is that students are being confronted with this problem - not really a good state of affairs if they are.

 
Average of ratings: -
Picture of Joshua Ellis
Re: The page isn't redirecting properly with Fresh installation
 

Okay I was having basically this same problem with a fresh install of 2.5+ using git.  The installation went smooth but when I got to the final step (hitting continue after the database gets populated) I got a DNS error.  I quickly realized that I was being redirected to "index.php?sessionstarted=1&lang=en".  Of course without a domain name that URL is pretty much useless.  After much digging I tracked it down to a few lines in admin/index.php that contained redirect functions similar to redirect('index.php?sessionstarted=1&lang=$CFG->lang');   I tried changing that a few ways... adding "./", "/admin", etc.  and most times I got that same redirect loop.

I FINALLY got it working by changing every instance of the incomplete redirect function to redirect("$CFG->wwwroot/admin/index.php?(finish the line here)");  that got me through most of the process until it happened again on an upgradesettings.php page.  So back to index.php I went and located the two instances upgradesettings.php appeared and added a "$CFG->wwwroot/admin/" to the front of that.  That got me through that last step.

Now I'm up and running.  The only area I am still having trouble with as far as I know is when I click on "Notifications" under the site administration menu I am getting "This page should automatically redirect. If nothing is happening please use the continue link below.
Continue" -- which is similar to what you guys are reporting.  Not sure if it's connected or not but seems suspicious that the problem, once again, is with that /admin/index.php file.

So I guess now I have a few questions... with the changes I made to admin/index.php will those be overwritten the next time I do a git pull?  If so, will I have problems again or maybe not since the installation has been completed?  Also, was my fix correct or was it just a workaround?  If my fix is what the code should have been, can it be corrected on the 2.5 stable branch so it will be good the next time I git pull?  Anyone else have any other insight?

This thread is a few months old so if I don't hear anything here I'll start a new thread.

Josh

 

 
Average of ratings: Useful (1)
Picture of Joshua Ellis
Re: The page isn't redirecting properly with Fresh installation
 

Btw here are the lines I changed, highlighted in red, from admin/index.php:

// If this is the first install, indicate that this site is fully configured
// except the admin password
if (during_initial_install()) {
set_config('rolesactive', 1); // after this, during_initial_install will return false.
set_config('adminsetuppending', 1);
// we need this redirect to setup proper session
upgrade_finished("$CFG->wwwroot/admin/index.php?sessionstarted=1&lang=$CFG->lang");
}

// make sure admin user is created - this is the last step because we need
// session to be working properly in order to edit admin account
if (!empty($CFG->adminsetuppending)) {
$sessionstarted = optional_param('sessionstarted', 0, PARAM_BOOL);
if (!$sessionstarted) {
redirect("$CFG->wwwroot/admin/index.php?sessionstarted=1&lang=$CFG->lang");
} else {
$sessionverify = optional_param('sessionverify', 0, PARAM_BOOL);
if (!$sessionverify) {
$SESSION->sessionverify = 1;
redirect("$CFG->wwwroot/admin/index.php?sessionstarted=1&sessionverify=1&lang=$CFG->lang");
} else {
if (empty($SESSION->sessionverify)) {
print_error('installsessionerror', 'admin', "$CFG->wwwroot/admin/index.php?sessionstarted=1&lang=$CFG->lang");
}
unset($SESSION->sessionverify);
}
}

// Cleanup SESSION to make sure other code does not complain in the future.
unset($SESSION->has_timed_out);
unset($SESSION->wantsurl);

// at this stage there can be only one admin unless more were added by install - users may change username, so do not rely on that
$adminids = explode(',', $CFG->siteadmins);
$adminuser = get_complete_user_data('id', reset($adminids));

if ($adminuser->password === 'adminsetuppending') {
// prevent installation hijacking
if ($adminuser->lastip !== getremoteaddr()) {
print_error('installhijacked', 'admin');
}
// login user and let him set password and admin details
$adminuser->newadminuser = 1;
complete_user_login($adminuser);
redirect("$CFG->wwwroot/user/editadvanced.php?id=$adminuser->id"); // Edit thyself

} else {
unset_config('adminsetuppending');
}

} else {
// just make sure upgrade logging is properly terminated
upgrade_finished('$CFG->wwwroot/admin/upgradesettings.php');
}

.......


// check that site is properly customized
$site = get_site();
if (empty($site->shortname)) {
// probably new installation - lets return to frontpage after this step
// remove settings that we want uninitialised
unset_config('registerauth');
redirect('$CFG->wwwroot/admin/upgradesettings.php?return=site');
}

.....

// Check if there are any new admin settings which have still yet to be set
if (any_new_admin_settings($adminroot)){
redirect('$CFG->wwwroot/admin/upgradesettings.php');
}

 

 
Average of ratings: Useful (1)
Picture of SVV MCA
Re: The page isn't redirecting properly with Fresh installation
 

Hello, Joshua and others

I am using 2.6.1 the complete moodle build. It has the moodle start and stop buttons. (pardon me... but I am no computer nerd!).

I couldn't get past the redirects either. I was using Notepad to copy/replace the code you'd shown in red and when I tried running, localhost/my, I got, 

"Parse error: syntax error, unexpected $end in D:\Moodle261\server\moodle\admin\index.php on line 593"

Unfortunately, I don't know how to proceed further. I have attached my index.php file here. Could you or someone be kind enough to post your final version of the index.php file that worked?

I would copy/replace that in my computer and hopefully, it should work.

 

Thanks much, in advance for your kind help,

SVV

 
Average of ratings: -
Picture of Hugues Fontenelle
Re: The page isn't redirecting properly with Fresh installation
 

Me too.

More precisely, I installed the Windows MOODLE_25_STABLE Distribution, Moodle 2.5.2+ (using XAMPP v1.7.4).

I got the Error 310 (ERR_TOO_MANY_REDIRECTS), right upon install, after registering the Administrator user, and before setting the webpage preferences.

@Joshua Ellis, I tried your solution but it didn't work for me, at least not verbatim, but I got inspired wink

The browser debugger was most useful however: <F12>, Network tab, I could see the page being redirected back and forth, and could see which page was being redirected: index.php?sessionstarted=1&lang=1

In the file C:\Program Files\Moodle\server\moodle\admin\index.php

I made a search and commented out:

//redirect("index.php?sessionstarted=1&lang=$CFG->lang");

It probably breaks something, but for the time being, it works.

PS: if you check out (using git), it should not overwrite your local changes. At worst you'll get a conflicted state which you'll need to address.

 

 
Average of ratings: Useful (5)
Picture of Andrew Downes
Re: The page isn't redirecting properly with Fresh installation
 

Thanks Hugues - this worked for me. Once I finished the installation I un-commented the line and now all is working fine.

 

Andrew

 
Average of ratings: -
Picture of Ronne Clay Santos
Re: The page isn't redirecting properly with Fresh installation
 

Thanks Hugues - this worked for me. Once I finished the installation I un-commented the line and now all is working fine.[2]

 
Average of ratings: -
Picture of Nick Maliha
Re: The page isn't redirecting properly with Fresh installation
 

Thanks Hugues, I've spent several hours trying to solve this problem with version 2.6, until I came to your post. It worked, but not sure whether it will affect other functions? Cheers, Nick. 

 
Average of ratings: -
Picture of Ghader Ahmadi
Re: The page isn't redirecting properly with Fresh installation
 

Thanks it's work

just commented out in line 448

 redirect("index.php?sessionstarted=1&lang=$CFG->lang");

 

 
Average of ratings: -
Picture of Rajaguru S
Re: The page isn't redirecting properly with Fresh installation
 

 

Thanks the answer helped me to solve the issue.

just commented out in line 448 in the file ( /admin/index.php)

 redirect("index.php?sessionstarted=1&lang=$CFG->lang");

 
Average of ratings: -
Picture of Ata Rafi
Re: The page isn't redirecting properly with Fresh installation
 

Thanks @Hugues This trick worked for me too

 
Average of ratings: -
Picture of imbu danilot
Re: The page isn't redirecting properly with Fresh installation
 

Worked for me too.

thanks Hugues, I just wonder why they do not try to fix this in the new releases.... I installed 2.6+

Imbu

 
Average of ratings: -
Picture of Balbir Rana
Re: The page isn't redirecting properly with Fresh installation
 

Thanks!!!! Hugues Fontenelle it works for me. I just save my Time. It's very useful.

 
Average of ratings: -
Picture of adnan saif
Re: The page isn't redirecting properly with Fresh installation
 

Thanks Hugues its working fine. but i face new issue. after commented out page working fine but css not load. please let me know what can i do


 
Average of ratings: -
Picture of Caner Öztürkten
Ynt: Re: The page isn't redirecting properly with Fresh installation
 
Average of ratings: -
Picture of Michael Reiter
Re: The page isn't redirecting properly with Fresh installation
 

Thank you Hugues Fontenelle! This also worked for moodle 2.7.


I installed moodle 2.7 locally on XAMP1.8.3 and I got stuck after saving the admin data (username, email, password)

When I uncommented the code, login was possible again.

After login, It asked me the site information (site name, short name, ... , support).

After hitting "save changes" everything was ok: I could logout and login normally and maintain the site.

 
Average of ratings: -
Picture of sushumna rao
Re: The page isn't redirecting properly with Fresh installation
 

Thanks a ton Hugues, it worked for me. In latest version 3.1.1 it is line number 700.

 
Average of ratings: -
Picture of mano bobi
Re: The page isn't redirecting properly with Fresh installation
 

If you are working at localhost, just go to xampp or wamp folder and find folder with name of "C:\Xampp\moodledata" . inside you will find out folder "cache". Just rename the cache folder with any name. Your problem solved. smile

try it......

 
Average of ratings: -
Picture of yusron nube
Re: The page isn't redirecting properly with Fresh installation
 

i has been installed moodle on my hosting. but after installing., my moodle can't access.


display a message like this The page isn't redirecting properly


This has been the second installation

my site  http://peserta.ppsdms.org/

anyone can help me sad
 
Average of ratings: -
Picture of john Simpson
Re: The page isn't redirecting properly with Fresh installation
 
Yusron, I tried your link and it works for me. Have you fixed it?
 
Average of ratings: -
Picture of nivedita setru
Re: The page isn't redirecting properly with Fresh installation
 

Thanks Mano.

This works for me on Moodle_27 build. I renamed /cache/ folder within moodledata. I don't think hacking code is right solution to this issue. This is..!!

 
Average of ratings: -
Picture of badi azze
Re: The page isn't redirecting properly with Fresh installation
 

go to moodledata folder and delet it it works for me good luck

badi

 
Average of ratings: -
Picture of Pedro Contreras
Re: The page isn't redirecting properly with Fresh installation
 

Deleting de "cache" folder inside the "moodledata" folder will do the trick! It seems to be a error inside moodle, but nothing to worry about

 
Average of ratings: -
Picture of yasith randika
Re: The page isn't redirecting properly with Fresh installation
 

HI guys, 

After some R&Ds about upgrading moodle to 2.66+ , I came out with a solid solution. have a copy of index.php from your working copy of the old moodle folder. Then search for the line "// Available updates for Moodle core " copy the entire set of codes under that comment 

// Available updates for Moodle core

$updateschecker = \core\update\checker::instance();

$availableupdates = array();

$availableupdates['core'] = $updateschecker->get_update_info('core',

    array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds));


then replace it in the new moodle's index.php file. in the same place without any errors it work as normal. 


 
Average of ratings: -
Picture of Dubbo Feng
Re: The page isn't redirecting properly with Fresh installation
 

Just empty the folder moodledata/cache, then refresh.

 
Average of ratings: -
Picture of vysakh b
Re: The page isn't redirecting properly with Fresh installation
 

Hello,

I have uploaded all the files with real data from staging server to live server and page was loading at that time, but now its showing  "page isn’t working". and  " didn’t send any data.

Please help me to find a solution for this. Thanks in advance 

 
Average of ratings: -
Picture of Ibrahim Halidu
Re: The page isn't redirecting properly with Fresh installation
 

Have you found a solution to your problem. If you have kindlt help me with it let me use that method to solve mine please

 
Average of ratings: -
Tijgertim
Re: The page isn't redirecting properly with Fresh installation
 

Sorry, I'm afraid there is still no "professional" nor true solution to the problem. I am guessing the moderators are not using Moodle professionally and the developers are either not informed or not bothered.

To keep seeing the same rubbish being peddled as a "solution" is annoying to say the least. It is NOT a solution, it is a TEMPORARY WORKAROUND.  In the real world, workarounds are only to aid while a real attempt is being made to solve the problem for good.


End of rant!

 
Average of ratings: -
Picture of Emma Richardson
Re: The page isn't redirecting properly with Fresh installation
Documentation writersParticularly helpful Moodlers

First, insulting the people that you are asking for help is not appreciated.  Especially when we are all just users like you and not being paid to offer assistance.  

The solution that is listed here is normally a one time fix for a corrupted cache.  This is the first post I have seen where it has been a recurring problem and indicates that there is something wrong with your server or your cache settings.  I would suggest looking at the cache settings first - did you set up opcache per the instructions found in the docs?  Or are you using a different cache engine? - in which case, it would not be a developer issue.

If you think this is a bug with the software, instead of whining about moderators not telling developers, why don't you put in a tracker ticket?  That is the process for reporting a bug and anyone can do it.  Just log in to tracker.moodle.org and report away,

 
Average of ratings: Useful (1)
Tijgertim
Re: The page isn't redirecting properly with Fresh installation
 

Repetitive comments about a "solution" seem to show a lack of ability to read or a repetitive nature of the problem.

But I bow to your suggestion about a tracker ticket - thank you

 
Average of ratings: -
Picture of Emma Richardson
Re: The page isn't redirecting properly with Fresh installation
Documentation writersParticularly helpful Moodlers

A repetitive problem on different servers with a one-time solution is very different to an issue where the solution is having to be repeated multiple times in a single installation. 

 
Average of ratings: -
Picture of Visvanath Ratnaweera
Re: The page isn't redirecting properly with Fresh installation
Particularly helpful Moodlers
Emma

I know, it has been some time. Still, where is the insult? Criticism, frustration, yes, but I fail to the an https://en.wikipedia.org/wiki/Insult.
 
Average of ratings: -
Tijgertim
Re: The page isn't redirecting properly with Fresh installation
 

Yes, this is the "solution" that keeps being peddled but it hardly resolves the repetitive nature of the problem - I would be emptying moodledata/cache 5 times a day... And how do you explain it to students visiting a professional site?

 
Average of ratings: -
Picture of Frank Jara
Re: The page isn't redirecting properly with Fresh installation
 

I was in this situation as well and found my memcached.exe scheduled task would error out. Correlating the date/time memcached would error out with the events in Event Viewer showed Windows Updates and VMware auto-updates would cause the issue. To solve my problem, I updated the scheduled task settings to auto start the task if it fails. Another option is to use PowerShell on a scheduled task that triggers every minute to check if memcached is running. If it is not, then it'll start the scheduled task. Below is the PS script if it's an option you like.


if((Get-ScheduledTask -TaskName "memcached" | Select State)[0].State -ne "Running")

{Start-ScheduledTask -TaskName "memcached"}


Hope this helps anyone having this problem consistently and on a Windows install. 

Frank

 
Average of ratings: -
Picture of Rahul Rai
Re: The page isn't redirecting properly with Fresh installation
 

Hi Mohit 

Please your self  clear  the cache in the Moodledata folder.

 
Average of ratings: -
Picture of Anna Rosan
Re: The page isn't redirecting properly with Fresh installation
 

I had the same problem, solved it by going to cpanel then look in the security tab if there is mod security , if yes deactivate it.

That was it for me.

Bestia


 
Average of ratings: -
Picture of Kendrick Kotter
Re: The page isn't redirecting properly with Fresh installation
 

Hi everyone,
I was facing the same problem. I am using the Xampp on Windows 10 64-bit. Tried a lot of possible solutions found online and only the Kanika's suggestions helped me fixed the issue.
Thanks a lot.
Cheers, Kendrick.

 
Average of ratings: -
Picture of daniel hardmann
Re: The page isn't redirecting properly with Fresh installation
 

I was facing the same issue, but then shifted to firefox instead of chrome and its fixed. Cheers Daniel 

 
Average of ratings: -