I have a problem. I am using slim and I have route for my main page:
$app->get(\'/\', function() use ($app) { ...
In one of my controll
Slim 4:
$response->withHeader('Location', '/redirect/to');
Or in place of fixed string:
use Slim\Routing\RouteContext;
$routeParser = RouteContext::fromRequest($request)->getRouteParser();
$url = $routeParser->urlFor('login');
return $response->withHeader('Location', $url);
Slim Documentation: http://www.slimframework.com/docs/v4/objects/response.html#returning-a-redirect RouteContext: https://discourse.slimframework.com/t/redirect-to-another-route/3582