If the redirect location is not provided to the redirect route (for
example, if the routed URL is merely /register rather than
/register/some/location) then page.js presents the whole URL as a match
to that param, which erroneously suggests that /register is the redirect
URL to follow after registering. This results in an infinite loop of
redirects.
With this change, redirect looping is prevented and this style of
register URL is instead redirected to the root. Tests are added for the
route handler.
Change-Id: Ia80b4d875ffa3072df812c7519bd5c0fdb70b404