Backport PR #6333: allow slash in root->tree redirect

- before #6117, only `/base_url/` worked
- after #6117, only `/base_url` worked
- after this PR, both should work.

closes #6329