From d3744cb37eb8a72677cdee2e254a077bed2d1b5c Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 6 Feb 2016 14:10:57 +0100 Subject: [PATCH] [#6124] Remove some escapes --- cookbook/routing/redirect_trailing_slash.rst | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/cookbook/routing/redirect_trailing_slash.rst b/cookbook/routing/redirect_trailing_slash.rst index 6b78dd718d6..1f2f5f89614 100644 --- a/cookbook/routing/redirect_trailing_slash.rst +++ b/cookbook/routing/redirect_trailing_slash.rst @@ -53,12 +53,7 @@ system, as explained below: */ public function removeTrailingSlashAction(Request $request) { - $pathInfo = $request->getPathInfo(); - $requestUri = $request->getRequestUri(); - - $url = str_replace($pathInfo, rtrim($pathInfo, ' /'), $requestUri); - - return $this->redirect($url, 301); + // ... } } @@ -68,7 +63,7 @@ system, as explained below: path: /{url} defaults: { _controller: AppBundle:Redirecting:removeTrailingSlash } requirements: - url: .*\/$ + url: .*/$ methods: [GET] .. code-block:: xml @@ -77,7 +72,7 @@ system, as explained below: AppBundle:Redirecting:removeTrailingSlash - .*\/$ + .*/$ @@ -95,7 +90,7 @@ system, as explained below: '_controller' => 'AppBundle:Redirecting:removeTrailingSlash', ), array( - 'url' => '.*\/$', + 'url' => '.*/$', ), array(), '',