我创建了一个多语言网站。在创建 SEO 用户友好的 URL 时面临问题。
当前 URL: http://localhost/example/en/user/myaccount或 http://localhost/example/fr/user/myaccount
想用 http://localhost/example/en/myaccount或 http://localhost/example/fr/user/myaccount更改它
路由.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'];
也试过
$route["myaccount"] = "user/myaccount";
$route["^(en|de|fr|nl|id|es)$/myaccount"] = "user/myaccount";
在这种情况下什么都行不通。已经在 routes.php 文件中使用了其他没有多语言的演示项目。它完美地工作。
$route["myaccount"] = "user/myaccount";
提前致谢