Commit 785f1b29 authored by Christian Giupponi's avatar Christian Giupponi

This check if the request page match the locale and the slug. If do not match...

This check if the request page match the locale and the slug. If do not match just do a 301 redirect so the user can see the correct page and the correct url, good for seo purpose.
parent 6d1bdc23
......@@ -38,6 +38,12 @@ class PublicController extends BasePublicController
$this->throw404IfNotFound($page);
$currentTranslatedPage = $page->getTranslation(locale());
if ($slug !== $currentTranslatedPage->slug) {
return redirect()->to($currentTranslatedPage->locale . '/' . $currentTranslatedPage->slug, 301);
}
$template = $this->getTemplateForPage($page);
return view($template, compact('page'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment