ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Miguel Mora Hernández -
Number of replies: 30

Hi all

First of all, I assure you that I have tried every single option I managed to find on the Internet so far with this problem:

· Setting wwwroot properly with https

· Index.php on admin folder

· Clearing coockies and cache from my searchers

· Deleting every single cache folder from my Moodle

· Trying multiples subdomains and redirecting those to moodle folder, index.php, login/index.php... etc

And none of them have worked so far I'm afraid.

The thing is that a year ago I created my domain and installed moodle in it. Everything worked fine until yesterday. I acquired exactly the same domain but with another extension (.de instead of .es) since it was cheaper to maintain. After setting everything up and comming across this problem, I searched the Internet to find a solution and applicated every single step I could (creating a backup of my whole FTP server first), but nothing was fixed.

It's remarkable that at the very beginning of this oddisey the first problems I got where 403, 404 and 500 errors. But in the end I always got the same "ERR_TOO_MANY_REDIRECTS" problem. I'm not able to display a php log message error either, because whenever I try to access my subdomain I simply get that error. 

I tried accessing it from several devices, VPN, proxies, everything. None of them would ever work though. 

At this point I wrote to my hosting support team but today is a free day and I have the weekend ahead so I think it will take a while to get an answer for them. My students aren't able to access my site either and thus I'm going a little crazy at this point.

Any suggestions? Any help will be appreciated.

· Moodle Version: Not really sure, I think it is 3.3 but I didn't checked it in a while. My moodle folder is called Moodle-81995 (if this makes any sense at all)

· Hosting Service: Easyname

· PHP Version: 7.3

Thanks in advance

Average of ratings: -
In reply to Miguel Mora Hernández

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
When you changed the hostname, what did you change or add in your web server configuration and your moodle configuration?
In reply to Howard Miller

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Miguel Mora Hernández -
Hi

Thanks for your quick answer!

I didn't change anything on my server. I renewed the hosting servide and changed my domain from "mydomain.es" to "mydomain.de" and my subdomain for moodle from "campus.mydomain.es" to "campus.mydomain.de".

About my moodle configuration I'm not sure if you're referring to editing the files (which I have alredy done as I say on my message) or if you're referring to moodle configuration itself (which is impossible for my right now for I cannot access my moodle site).

I set everything as it was before migration, only changing .es to .de.

One interesting thing is:

If I delete .htaccess from my Moodle folder, and refer my subdomain to Moodle folder, I directly get to install.php. If I refer my subdomain to moodle/index.php I get the same error again (too many redirections). If I upload .htaccess again to my Moodle folder everything remains the same. 

Quite frustrating 
In reply to Miguel Mora Hernández

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
So, in your Moodle's config.php, you now have

$CFG->wwwroot = 'https://campus.mydomain.de'

??

Also, are you saying that you haven't done *anything* to redirect existing links trying to find the old campus.mydomain.es to campus.mydomain.de ??

And... I doubt it'll fix this problem but you should also run the "replace" script - https://docs.moodle.org/37/en/Administration_via_command_line#Search_and_replace_text
Average of ratings: Useful (1)
In reply to Howard Miller

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Miguel Mora Hernández -
Quote: So, in your Moodle's config.php, you now have

$CFG->wwwroot = 'https://campus.mydomain.de'

Exactly. That's what I have.

Quote: Also, are you saying that you haven't done *anything* to redirect existing links trying to find the old campus.mydomain.es to campus.mydomain.de ??

Not really sure I understand what you mean. I have changed config.php to redirect moodle to the new domain (wwwroot) and I also redirected my new subdomain "campus.mydomain.de" to /html/apps/moodle (as it was in the previous domain).

I'm going to check the link you sent me and see if it makes any differents.

I really appreciate your help. Thank you kindly!
In reply to Miguel Mora Hernández

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Is your site publicly available? Can you tell us what the *actual* URL is?
In reply to Howard Miller

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Miguel Mora Hernández -
In reply to Miguel Mora Hernández

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
"Error 403. Access forbidden"

Interestingly, https://campus.magisteronline.de/index.php gives a 404 (not found error) implying that Moodle "isn't there"

Even more interestingly, https://campus.magisteronline.de/admin/index.php brings up the start of the installation process. 
In reply to Howard Miller

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Miguel Mora Hernández -
Yep. If now I delete .htaccess it redirects me to "install.php". Now I've deleted it just for you to check it.

My directory permissions on config.php are 0777, so no clue why it says error 403.
In reply to Miguel Mora Hernández

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Why have you a .htaccess file? What's in it?
In reply to Miguel Mora Hernández

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
There isn't an installed Moodle at https://campus.magisteronline.de. I'm not sure what else to say.

AND.... if you go to the environment page, this is Moodle 3.4 and you have PHP 7.3 installed!  Moodle 3.4 won't run on PHP 7.3.   You said you thought you were running 3.3 (missed this before) but regardless, 3.3 and 3.4 don't work with PHP 7.3. So....
In reply to Howard Miller

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Miguel Mora Hernandez -
I can assure you it is installed for it is on my FTP server. The only "difference" is that I installed it previously on "campus.magisteronline.es" a year ago, and I simply changed my domain yesterday. That's all.

quote: Why have you a .htaccess file? What's in it?

Now I've uploaded it again to my moodle folder, so those urls won't be useful until I delete it. If you try to access them you will get errors.

My htaccess only has these lines:

# Redirect 404 //index.php
#
In reply to Miguel Mora Hernandez

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
The code might be there but Moodle isn't "installed". That's because of two things (either or both)

There is no config.php or the permissions on config.php are wrong (the web server can't open it)
The database isn't installed (or the settings in config.php point to an empty database)

However, we still have the problem that your Moodle version is incompatible with your PHP version.

OK - your .htaccess is just to block access to your site
Average of ratings: Useful (1)
In reply to Howard Miller

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Miguel Mora Hernandez -
Database is properly referred and online, config.php exists indeed, and my database is not empty (already checked a few minutes ago).

As I can see I'm bound to reinstalling the whole thing and upgrading it to a newer version, but I'm now able to access moodle and create a backup. I have downloaded my whole FTP server via Filezilla and my database from phpmyadmin.

Do I have everything I need to reinstall my moodle and restore every curse and stuff I got or do I need anything else?
In reply to Howard Miller

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Miguel Mora Hernandez -
So how is it possible that, literaly, two days ago I was able to use my moodle on my site, and today I'm not?
In reply to Miguel Mora Hernandez

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Did your hosting company upgrade PHP? And probably other stuff too....

If it's Easyname then their FAQ says you can change the PHP version in the control panel
In reply to Howard Miller

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Miguel Mora Hernandez -
Yeah, I tried that too. To 7.0 and to 5.6. Nothing changed.

As I can see I'm bound to reinstalling the whole thing and upgrading it to a newer version, but I'm now able to access moodle and create a backup. I have downloaded my whole FTP server via Filezilla and my database from phpmyadmin.

Do I have everything I need to reinstall my moodle and restore every curse and stuff I got or do I need anything else?
In reply to Miguel Mora Hernandez

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You need a complete backup of the database and a complete backup of the 'moodledata' area (pointed to by $CFG->dataroot in config.php).

Personally, I'd want to understand what had gone wrong.

As I said, Moodle doesn't think your site is installed from the view I have. That's not a good thing. If you reinstall and it still doesn't work? Well....
In reply to Howard Miller

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Miguel Mora Hernandez -
I'd love to understand what happened too, actually it's the only way to prevent it from happening again in the future. But I have a lot of students who right now are not able to continue their work, so I think I'm going to try an upgrade to 3.7 latest version.

I have downloaded the whole moodle folder, moodledata included (just for the sake of knowledge, in my case it is called .htsfmsk9ml96lk.data , quite odd).

So, if you consider that upgrading could fix the problem I'll do it right now. What do you think? From this point, I'm completely lost.
In reply to Miguel Mora Hernandez

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Honestly... I doubt it will make any difference at all. Something is badly wrong with permissions or settings. At least, that is my guess.

I rarely say this. But if you want to PM me the login details for your hosting, I'll take a quick look. 
In reply to Howard Miller

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Miguel Mora Hernandez -
When I first tried to install moodle, the very first time, I wasn't able to do it and I had to ask for help to the support service.

The issue was that I was able to run moodle installation process, but I wasn't able to install it nor accessing my database. They fixed it but didn't give me any explanation about the matter.

When they fixed it (they installed 3.3 version) I upgraded it manually to 3.4.7 and from that point everything went fine. It is just my guess but I think that the problem was that I have no access to /data/web/e101xxx root, for I'm only able to work from /data/web/e101xxx/html and not the previous folders, so maybe it has something to do with it.
In reply to Miguel Mora Hernández

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Where other changes made too? Different host? Site migrated? Upgrades done?
1. I am not sure moodle 3.3 is compatible with Php 7.3 - check that first.
2. Have you looked at the docs/forum for changing the url?
3. You need to change the entry in config.php and you need to run the replace tool on the database (yoursite/admin/tool/replace/index.php) - did you do that? Are you deleting cache folders from your moodledata folder?
4. You should have only needed to redirect the new domain to the existing folder and remove the redirect for the old domain in your domain settings on your host.
In reply to Emma Richardson

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Miguel Mora Hernández -
Nope. Same site, same host, no upgrade done. I simply changed "mydomain.es" to "mydomain.de".

1. Finally I managed to find out the version. It is 3.4.7.
2. Yes, they only say to change wwwroot to the new one (which I have done) and cache removal (which I have also done)
3. I'm not able to use the replace tool. I get the same error (too many redirects)
4. Already done

Thanks for your help!
In reply to Miguel Mora Hernández

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
The replace tool is command line. You can't get too many redirects on the command line
In reply to Howard Miller

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Miguel Mora Hernández -
I assure you I was getting that error, no matter what.

I deleted .htaccess and uploaded it again after it didn't fix anything and now when I try to access again to replace/index.php I got a new error I didn't get until this point (something different at least).

Error reading from database
In reply to Miguel Mora Hernández

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You're doing it wrong. That's a browser message. You can't get a browser message on the command line. However... can you post a screen shot?
In reply to Howard Miller

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Miguel Mora Hernandez -

I got my other account suspended for Spam. Definately today is not my day... 


I was trying to upload a screenshot and then I got banned for spamming so, no screen shot sorry. It just says "database error" and that's all, on google chrome. 

In reply to Miguel Mora Hernandez

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
See my comments above. There is something very broken on your site.
In reply to Miguel Mora Hernández

Re: ERR_TOO_MANY_REDIRECTS (Already tried every single tip on the Internet)

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Just to tie this up... despite having the control panel in Spanish (don't speak a word). Three problems...

1. Somehow the database prefix in config.php differed from the prefix used on the tables in the database.

2. PHP was set to use Redis sessions rather than file-based. Moodle didn't like this at all.

3. The ssl certificate was wrong somehow, but Miguel sorted that himself as the language barrier finally got to me smile