Redirect loop

I’ve set up several redirects on my site using the ‘Advanced > Page redirect’ option. All have worked absolutely fine up until now; they simply go from a top-level page to one of that page’s children.

However, having just enabled this for one more page - the last ordered top-level page (if that makes any difference) - I am now getting redirect loops from every page in the site (excluding the admin interface) to the location that I have just asked to redirect to.

The redirect I’ve just set up that’s doing this is from /contact to /contact/info - so every page is redirecting to /contact/info, including /contact/info itself. What’s going on here?

Can you please provide your ‘raw’ markdown file (if a page) or site.yaml (if you added them there). So i can take a look at your syntax?

Everything is specified on the pages themselves as it stands. (and just to clarify - all frontmatter is surrounded by ---s)

08.contact/default.md

title: 'Contact us'
redirect: /contact/info

08.contact/01.info/default.md

title: 'Contact info'
---

Hmm… I don’t see anything obvious. Perhaps you could zip up your user folder and PM the location I can download it and test it out?

Cheers, PM’d you.

Ok, this works fine in Grav 1.0.10, but it appears to cause the looping in Grav 1.1.0-beta. I’ll take a look at this today.

Thanks - I’m on 1.0.10 though.

Ok I found the problem. I think this is the same in Grav 1.0 as it is in 1.1, so you can probably just apply this same fix in your local:

Basically you have a page.find('/contact') in your footer links, this is called with redirect=false so it doesn’t follow redirect links, however, this was falling into this check even when the page was legitimately found, skipping the check for page valid page. I broke out the page level redirect from this check and that sorted it.

Nasty little bug that really only happened because you were doing a find() on the same page you had a redirect in. All sorted now I think!

Actually hold on… might of found an issue with my ‘fix’

Better fix: https://github.com/getgrav/grav/commit/a3e31c786ed04108cf88474680ee79528d6c7880

Excellent! Thanks. Will this fix be in the 1.1 release?

Yup