Welcome Guest, Not a member yet? Register   Sign In
Routing Advice

(01-07-2021, 03:29 AM)demyr Wrote: Hi all,

I would like to ask your suggestions about an issue on which I am working:

Imagine a website which has been prepared in a few languages, such as english (en), German (de), Italian (it) etc.

By the way, English is the main/base one.

If I set up the base url for the domain like mywebsite.com, there is no problem to switch to other languages such as : mywebsite.com/de or mywebsite.com/it. Because the site works for English as the base : mywebsite.com/about-us, mywebsite.com/blog-detail etc.

But if I set up the base url for /en , then how can I route for the other languages?
Because my pages are like these:

$routes->get('en', 'SiteEn::index_en');
$routes->get('en/products', 'SiteEn::product_categories_en');
$routes->get('en/product-detail/(:segment)', 'SiteEn::product_detail_en/$1');
$routes->get('en/contact', 'SiteEn::contact_en');;

$routes->get('en/(:segment)', 'SiteEn::other_pages_en');

//For Other Languages


As I don't know which language can the site owner sets in admin panel, I cannot fix it like :

PHP Code:

On the contrary it must be aranged automaticaly: (What I want and need):

PHP Code:

As I said if I set the base url for "/en" ,  it works like: mywebsite.com/en/it, not like mywebsite.com/it

What would you suggest for this kind of problem and how do you handle this kind of problem?


Hi, have you tried with the {locale} parameter?


Messages In This Thread
Routing Advice - by demyr - 01-07-2021, 03:29 AM
RE: Routing Advice - by nicojmb - 01-07-2021, 07:10 AM
RE: Routing Advice - by demyr - 01-07-2021, 01:18 PM
RE: Routing Advice - by MrWhite - 01-07-2021, 06:42 PM
RE: Routing Advice - by demyr - 01-07-2021, 11:56 PM

Theme © iAndrew 2016 - Forum software by © MyBB