Skip to content

Commit

Permalink
added RedirectingController.php
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisxrow committed Aug 31, 2015
1 parent c5352bf commit 4a24e0a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions Controller/RedirectingController.php
@@ -0,0 +1,18 @@
<?php

namespace xrow\bootstrapBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;

class RedirectingController extends Controller
{
public function removeTrailingSlashAction(Request $request)
{
$pathInfo = $request->getPathInfo();
$requestUri = $request->getRequestUri();

$url = str_replace($pathInfo, rtrim($pathInfo, ' /'), $requestUri);
return $this->redirect($url, 301);
}
}

0 comments on commit 4a24e0a

Please sign in to comment.