Search code examples
http-redirectsilexboilerplatestoryblok

Redirect Silex Boilerplate in Storyblok Project


How can I add redirects to my Storyblok project when it is using the Silex Boilerplate?


Solution

  • You can redirect to another page by returning a RedirectResponse response, which you can create by calling the redirect method:

    app->get('/{{entry_path}}', function () use ($app) {
        return $app->redirect('/{{exit_path}}');
    });
    

    http://silex.sensiolabs.org/doc/2.0/usage.html#redirects

    When you want to delegate the rendering to another controller, without a round-trip to the browser (as for a redirect), use an internal sub-request (Don't use this if you really want to redirect your page). We provide such an forward in the app.php for the /home slug already, so /home page would be accessible on / without redirecting but doing a subrequest.