Welcome Guest, Not a member yet? Register   Sign In
Localization duplicate page problem when locale set in routes
#2

(This post was last modified: 01-22-2020, 08:11 PM by jameslittle.)

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



Theme © iAndrew 2016 - Forum software by © MyBB