Skip to content

Commit

Permalink
This check if the request page match the locale and the slug. If do n…
Browse files Browse the repository at this point in the history
…ot match just do a 301 redirect so the user can see the correct page and the correct url, good for seo purpose.
  • Loading branch information
cgiupponi committed Jul 31, 2018
1 parent 6d1bdc2 commit 785f1b2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Modules/Page/Http/Controllers/PublicController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public function uri($slug)

$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'));
Expand Down

0 comments on commit 785f1b2

Please sign in to comment.