Site won't load without backslash - redirect error

Site won't load without backslash - redirect error

per Terry Coates -
Nombre de respostes: 4
I have been battling a redirect error and I finally got to where I can reproduce the problem:

  • The path to my site is https://disctraininghub.com/elearning-center
  • If you go to that address, the page won't load due to too many redirects
  • However, if you add a trailing slash, the page loads properly
  • This behavior is consistent across Chrome, Firefox and Safari

I tried putting the trailing slash in the config.php, but apparently there is an edit for that and Moodle shows an error that explicitly says it doesn't allow the trailing slash.

The problem just started on its own one day recently, but not sure when. Since I had some upgrades to do, I did those first. The problem didn't go away. I will reach out to my host for their input, but any thoughts from the community are welcome!

Pertinent info:
Version:  Moodle 3.4.2+ (Build: 20180322)
Host: Webfaction, server running CentOS 6,
PHP version 7.1.15
Installed in a folder in a Joomla 3.8.6 site integrated with Joomdle


Mitjana de qualificacions: -
En resposta a Terry Coates

Re: Site won't load without backslash - redirect error

per Howard Miller -
Imatge Core developers Imatge Documentation writers Imatge Particularly helpful Moodlers Imatge Peer reviewers Imatge Plugin developers
$ curl -I https://disctraininghub.com/elearning-center
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Thu, 29 Mar 2018 14:36:13 GMT
Content-Type: text/html; charset=iso-8859-1
Connection: keep-alive
Location: http://disctraininghub.com/elearning-center/


Which is saying that your nginx configuration is sending a 301 header saying that URL minus slash is to be redirected to URL with slash. Which Moodle doesn't like.  Short answer, it's your nginx config. I don't speak nginx so can't be much more use.

En resposta a Howard Miller

Re: Site won't load without backslash - redirect error

per Terry Coates -

Thanks for the quick reply, Howard. The only place where I would be able to add a redirect is in the .htaccess file at the site's root (works just like Apache), but there are no 301's in there. I forwarded your info to my host to see if that gets me anywhere.

En resposta a Terry Coates

Re: Site won't load without backslash - redirect error

per Howard Miller -
Imatge Core developers Imatge Documentation writers Imatge Particularly helpful Moodlers Imatge Peer reviewers Imatge Plugin developers
En resposta a Howard Miller

Re: Site won't load without backslash - redirect error

per Terry Coates -

Just to close this one off, I got the following reply from Webfaction and the problem has been resolved:


"I created a manual redirect app for your sites HTTP record called 'dth_2018_redirect'. As per,
https://docs.webfaction.com/software/static.html?highlight=http%2520to%2520https#redirecting-from-http-to-https

And the site doesn't seem to be stuck anymore in the redirect loop."


And I can confirm that the issue has been solved.