![]() |
How to set default Locale {locale} on default redirected controller? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12) +--- Thread: How to set default Locale {locale} on default redirected controller? (/showthread.php?tid=81851) |
How to set default Locale {locale} on default redirected controller? - luckmoshy - 05-10-2022 Hi all! I have an app that works ok in different languages but want to filter and fix on home URL to append locale as PHP Code: /*Filter class*/ I want if any incoming request should fall on eg: (www. example.com/en) and not (www. example.com) PHP Code: public function index(){ RE: How to set default Locale {locale} on default redirected controller? - demyr - 05-10-2022 Well, On Routes.php you can assign {locale} for the homepage and maybe this easy approach might give you idea for the rest: PHP Code: $lang = $this->request->uri->getSegment(1); //this is the language code part. So, it will automatically redirect to your default language, whatever it is.. RE: How to set default Locale {locale} on default redirected controller? - InsiteFX - 05-11-2022 IncludeBeer has a very nice tutorial on creating a Multi-Language web site for a Blog. IncludeBeer Website |