CodeIgniter Forums
Seo url and multilanguage - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: Best Practices (https://forum.codeigniter.com/forum-12.html)
+--- Thread: Seo url and multilanguage (/thread-74835.html)



Seo url and multilanguage - togrul614 - 11-13-2019

Hello,

I have a problem with routing. I have a website in 3 languages, AZ, EN, RU. And I have dynamic pages created from admin. So I have 3 page domain/about, domain/en/about, domain/ru/about. Every slug is different depend on language. So I have another domain/jobs/etc , domain/en/jobs/etc/. and it continues like this. 

How I can do this routing like WordPress?


RE: Seo url and multilanguage - ciadmin - 11-13-2019

Not sure how Wordpress might handle this, but an example using the {locale} routing segment is in https://github.com/codeigniter4projects/website2


RE: Seo url and multilanguage - loopzzz - 11-15-2019

first of all wordpress handles page translations through a plugin only (correct me if im wrong) languages are supported only for localization of interface and other static strings.

in CI you must decide the url structure to be like /{language}/page-url/page-url/...... - language and multi level nesting

what i would do is to process the URL params before the controller method is called (_remap or similar) then to pass all the page data into a single showPage($lang, array $slugs) method which will handle the nesting validation then retrieve the correct page