Reputation: 161
I have created a multi-language website. Facing issue while creating SEO user-friendly URL.
current URL: http://localhost/example/en/user/myaccount OR http://localhost/example/fr/user/myaccount
want to change it with http://localhost/example/en/myaccount OR http://localhost/example/fr/user/myaccount
routes.php
$route['default_controller'] = 'welcome';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
// URI like '/en/about' -> use controller 'about'
$route['^(en|de|fr|nl|id|es)/(.+)$'] = "$2";
// '/en', '/de', '/fr','/es' and '/nl' URIs -> use default controller
$route['^(en|de|fr|nl|id|es)$'] = $route['default_controller'];
also tried with
$route["myaccount"] = "user/myaccount";
$route["^(en|de|fr|nl|id|es)$/myaccount"] = "user/myaccount";
Nothing will work in this case. Already used following in routes.php file other demo projects with out multi-language. There it's work perfectly.
$route["myaccount"] = "user/myaccount";
Thanks in advance
Upvotes: 0
Views: 205
Reputation: 21
you can consult the documentation for routes here https://www.codeigniter.com/user_guide/general/routing.html
and for your problem
$route["(:any)/myaccount"] = "user/myaccount/$1";
Upvotes: 0