• 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Localization duplicate page problem when locale set in routes

#2
So that is the way the documentation says it should behave. If CI can't match a locale, it's going to honor the route and serve your default locale.

But definitely agree that this arrangement could have SEO ramifications for duplicate content. And it's probably not good security to have arbitrary URLs that will answer to any string.

This isn't tested, but in your function, "App\Books::index" in the example, you probably need something like:

PHP Code:
$config = new \Config\App();

if (!
in_array($this->request->uri->getSegment(1), $config->supportedLocales)) {
   throw \CodeIgniter\Exceptions\PageNotFoundException::forPageNotFound();
   exit();



Hope that helps.
Designer, developer and Diet Dr. Pepper addict. Messing up PHP since <?= $when['year';] ?>
Reply


Messages In This Thread
RE: Localization duplicate page problem when locale set in routes - by jameslittle - 01-22-2020, 08:04 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.