From 804af3e9fc461f104121e48f70cef8f2717f0191 Mon Sep 17 00:00:00 2001 From: Awilum Date: Tue, 11 Jun 2019 17:07:33 +0300 Subject: [PATCH] Flextype Core: Psr7Middlewares\Middleware\TrailingSlash added #117 --- flextype/bootstrap.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/flextype/bootstrap.php b/flextype/bootstrap.php index f108cf93..881599c5 100755 --- a/flextype/bootstrap.php +++ b/flextype/bootstrap.php @@ -18,6 +18,8 @@ use Flextype\Component\Filesystem\Filesystem; use Thunder\Shortcode\ShortcodeFacade; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; +use Psr7Middlewares\Middleware; +use Psr7Middlewares\Middleware\TrailingSlash; use Slim\Flash\Messages; use League\Glide\ServerFactory; use League\Glide\Responses\SlimResponseFactory; @@ -90,6 +92,11 @@ $flextype['logger'] = function($container) { */ $app->add($flextype->get('csrf')); +/** + * Add middleware TrailingSlash for all routes + */ +$app->add((new TrailingSlash(false))->redirect(301)); + /** * Add emitter service to Flextype container */