Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect loop on / #1736

Closed
jpass opened this issue Nov 3, 2017 · 2 comments
Closed

Redirect loop on / #1736

jpass opened this issue Nov 3, 2017 · 2 comments

Comments

@jpass
Copy link

jpass commented Nov 3, 2017

If we set custom_base_url to relative url, homepage returns infinite loop.

Simple fix is to add check in system/src/Grav/Common/Uri.php on line 308:

$redirect = str_replace($this->root, '', rtrim($uri, '/'));
// If configured to, redirect trailing slash URI's with a 302 redirect
if ($uri !== '/' && $redirect !== $this->base()  && $config->get('system.pages.redirect_trailing_slash', false) && Utils::endsWith($uri, '/')) {
    $grav->redirect($redirect, 302);
}

I will try to post more information soon.

rhukster added a commit that referenced this issue Nov 8, 2017
@rhukster
Copy link
Member

rhukster commented Nov 8, 2017

I implemented your fix, but then discovered several other issues related to custom_base_url when using both absolute and relative custom paths. Hopefully my commit will address all of these, please test :)

@jpass
Copy link
Author

jpass commented Nov 10, 2017

Your fix is perfect :)

@rhukster rhukster closed this as completed Dec 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants