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
give your '/' route a name,
$app = new \Slim\Slim();
$app->get('/', function () {
echo "root page";
})->name('root');
$app->get('/foo', function () use ($app) {
$app->redirect($app->urlFor('root') );
});
$app->run();
This should give you the correct url to redirect
http://docs.slimframework.com/routing/names/ http://docs.slimframework.com/routing/helpers/#redirect