server_redirect |permanent and temporary | Status Code 301 and 303

server_redirect |permanent and temporary | Status Code 301 and 303

by Jose A. Hernandez -
Number of replies: 15

Hello: 

The version of Moodle installed is 3.8.2 https://optamoaprendizaje.com/Inttelgua

Suddenly my Moodle application stop working, and the message that was coming up in the browser was "ERR_TOO_MANY_REDIRECTS" (server_redirect |permanent and temporary | Status Code 301 and 303). I try to update Moodle from the cPanel but did not change anything. These were the steps that I follow: 

1. Deleted cache and local cache from the file manager. 

2. Check with my hosting provider and reply with a list of errors https://privatebin.support-tools.com/?2397e5455b510299#opI7czXdSIqOVQA9FJD05hGKFGOYIKt0VP600kxVLrQ= 

3. I got into debugging mode and got an error line 308 if (sha1_file($cachefile) === sha1($content)) {

4. Talked again to my hosting provider (resellerclub), and they this was their answer PHP Notice: Undefined property: stdClass::$reverse proxy ignore in Moodle site:moodle.org

5. I made a new installation parallel to my current installation and gave me the same error ERR_TOO_MANY_REDIRECTS. 

6. Installed the backup.

And that's about all I did since last night and still not working; if anyone can shed some light, I will greatly appreciate it. 


Average of ratings: -
In reply to Jose A. Hernandez

Re: server_redirect |permanent and temporary | Status Code 301 and 303

by Steel Bull -
...If you maked clean installation and it still not works, maybe you are using wrong PHP version, or try to disable cache engine in your PHP server and try again.
In reply to Steel Bull

Re: server_redirect |permanent and temporary | Status Code 301 and 303

by Jose A. Hernandez -
Hey Steel, the version that I am using is PHP 7.3.15
In reply to Jose A. Hernandez

Re: server_redirect |permanent and temporary | Status Code 301 and 303

by Steel Bull -
PHP version is OK, and...

Enable mod rewrite on your hosting, download latest moodle package, unzip into main public folder of your hosting, use Mariadb DB and install it. It must works.
In reply to Jose A. Hernandez

Re: server_redirect |permanent and temporary | Status Code 301 and 303

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 are lots of reasons for this. I would start by enabling Debugging in config.php and then checking both my web server access and error logs very carefully.

Check that you don't have any .htaccess files that you shouldn't have (classic problem is installing Moodle in the same place as a Blog - e.g. Wordpress) and/or rewrites in your web server configuration.

Have you also tried simply using a different browser? Sometimes the problem is with the browser cache.
In reply to Howard Miller

Re: server_redirect |permanent and temporary | Status Code 301 and 303

by Jose A. Hernandez -
Thanks, Howard: it seems that my hosting provider is having issues with the varnish memory on their end, and that was the root cause of my problem, in the end, decide to move to another hosting provider.
In reply to Howard Miller

Re: server_redirect |permanent and temporary | Status Code 301 and 303

by Jose A. Hernandez -
Alright, so we move to another hosting provider and got a different error now HTTP ERROR 500

2020-03-14 22:55:47 UTC [apache][core:alert] [pid 14768] [client 98.195.41.143:57174] /home/u461-cu2a4y28ygdh/www/optamoaprendizaje.com/public_html/Inttelgua/.htaccess: AllowOverride not allowed here

2020-03-14 21:41:50 UTC [apache][core:alert] [pid 19337] [client 98.195.41.143:42408] /home/u461-cu2a4y28ygdh/www/optamoaprendizaje.com/public_html/Inttelgua/.htaccess: AllowOverride not allowed here, referer: https://optamoaprendizaje.com/Inttelgua/

I tried with Opera, safari and chrome
In reply to Jose A. Hernandez

Re: server_redirect |permanent and temporary | Status Code 301 and 303

by Ken Task -
Picture of Particularly helpful Moodlers

@Jose

In your /Inttelgua/ directory there is an apache/hidden .htaccess file that appears to be trying to set AllowOverride and your nginx server doesn't like that.

Look at that file and use:

See https://www.liquidweb.com/kb/convert-htaccess-rules-nginx-directives/

for help.

Moodle code doesn't distribute with an .htaccess file in it's code. So that must have been something for the set up of your old hosting provider.

'SoS', Ken

Average of ratings: Useful (1)
In reply to Jose A. Hernandez

Re: server_redirect |permanent and temporary | Status Code 301 and 303

by Steel Bull -
You need to enable ModRewrite in settings on your hosting.
In reply to Steel Bull

Re: server_redirect |permanent and temporary | Status Code 301 and 303

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
No you don't. You need to find out why you have an .htaccess file that shouldn't be there.
In reply to Howard Miller

Re: server_redirect |permanent and temporary | Status Code 301 and 303

by Steel Bull -
Ciao Howard, it's because hosting. When you will change some configuration in admin of hosting, it will modify or store the new .htaccess file with the config. It's normal for most hostings.
In reply to Steel Bull

Re: server_redirect |permanent and temporary | Status Code 301 and 303

by Ken Task -
Picture of Particularly helpful Moodlers

'...most hosting...' ... where?  OP's hosting is resellerclub which offers a lot of different services.

OP's site shows running nginx (at least with curl test).  So if the server panel (cPanel/Plesk/whatever) is, as you say, 'modify or store the new .htaccess file with the config' then it must be running some sort of Proxy?

https://www.nginx.com/resources/wiki/start/topics/examples/likeapache-htaccess/

Conclusion from info above:

"Stop using .htaccess. It’s horrible for performance. NGINX is designed to be efficient. Adding something like this destroys that."

Dunno ... looks like a hosting provider issue to me! :|  Not all 'resellers' are a like! smile

'SoS', Ken

In reply to Ken Task

Re: server_redirect |permanent and temporary | Status Code 301 and 303

by Jose A. Hernandez -
I moved the site to SiteGound yesteday, thanks for your reply. As reseller club share linux hosting mention that they were having some varnish issues.
In reply to Ken Task

Re: server_redirect |permanent and temporary | Status Code 301 and 303

by Jose A. Hernandez -

I am very thankful for all of your support, as you know when issues with clients' sites arise, and the solution is not apparent, it's challenging to find an answer. Knowledgeable contributions are vital to sort out the errors and find a solution as the ones provided by all of you. 

In the end, it was an issue with the hosting provider server (reseller Linux shared server https://www.resellerclub.com/reseller-hosting); 

I moved my website to another hosting provider (siteground.com). Their customer services were fantastic and got it back online on Sunday afternoon, meeting what we offer to our client.

The first transfer did not work and was still showing errors, but we try a second transfer, and it worked perfectly, and since then, the website has not had any issues (knock on wood).

In reply to Steel Bull

Re: server_redirect |permanent and temporary | Status Code 301 and 303

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I find it strange that if an .htaccess file is required by the hosting company then they would also configure the web server to actually read it. That, however, would be a question from the host's support.

Regardless, it's a big mistake to assume that all hosts works the same way.