mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-21 09:35:49 +02:00
Fixed redirection, when no locale and no valid path were given
This commit is contained in:
parent
6e74eb8276
commit
adf5db1a0a
2 changed files with 6 additions and 2 deletions
|
@ -7,4 +7,6 @@ redirector:
|
||||||
path: /{url}
|
path: /{url}
|
||||||
requirements:
|
requirements:
|
||||||
url: ".*"
|
url: ".*"
|
||||||
controller: App\Controller\RedirectController:addLocalePart
|
controller: App\Controller\RedirectController:addLocalePart
|
||||||
|
# Dont match localized routes (no redirection loop, if no root with that name exists)
|
||||||
|
condition: "not (request.getPathInfo() matches '/\\\\/[a-z]{2}(_[A-Z]{2})?\\\\//')"
|
|
@ -34,6 +34,7 @@ namespace App\Controller;
|
||||||
use App\Entity\UserSystem\User;
|
use App\Entity\UserSystem\User;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||||
|
|
||||||
class RedirectController extends AbstractController
|
class RedirectController extends AbstractController
|
||||||
{
|
{
|
||||||
|
@ -57,7 +58,8 @@ class RedirectController extends AbstractController
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$new_url = str_replace($request->getPathInfo(), '/' . $locale . $request->getPathInfo(), $request->getUri());
|
//$new_url = str_replace($request->getPathInfo(), '/' . $locale . $request->getPathInfo(), $request->getUri());
|
||||||
|
$new_url = $request->getUriForPath('/' . $locale . $request->getPathInfo());
|
||||||
|
|
||||||
return $this->redirect($new_url);
|
return $this->redirect($new_url);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue