Localization duplicate page problem when locale set in routes |
Hello everyone!
When we set locale in routes as says localization manual: PHP Code: $routes->get('{locale}/books', 'App\Books::index'); We get a problem when any URLs with any words in the locale segment become available: example.com/any_word/books For example, your demo page https://website2.codeigniter.com/en/download can be also opened as https://website2.codeigniter.com/anyotherword/download or https://website2.codeigniter.com/anything/download This creates a big problem of duplicate pages in search engines. It is better that such pages return 404 errors We can solve this problem by comparing first segment with supportedLocales. But this will not work if we do not need to specify the locale for the default language in routes. How can we fix it correctly? |
Welcome Guest, Not a member yet? Register Sign In |