0

我创建了一个多语言网站。在创建 SEO 用户友好的 URL 时面临问题。

当前 URL: http://localhost/example/en/user/myaccounthttp://localhost/example/fr/user/myaccount

想用 http://localhost/example/en/myaccounthttp://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";

提前致谢

4

1 回答 1

0

您可以在此处查阅路线文档 https://www.codeigniter.com/user_guide/general/routing.html

和你的问题

$route["(:any)/myaccount"] = "user/myaccount/$1";
于 2019-08-09T11:35:47.310 回答