Handle $redirect to a route with parameters

Test $redirect by trying to match it to a route, which enables passing $redirect that contains parameters. If match() returns NULL then we assume the $redirect parameter contains a named route, as was the case prior to this commit.