Use toUrl() after validating routeMatch

After validating that $redirect matches a route within the application, we know it is not a url to an external site, so can simplify the code by using toUrl().