国际化 i18n - 404 找不到页面


internationalization i18n - 404 Page Not Found

我正在使用 https://github.com/EllisLab/CodeIgniter/wiki/CodeIgniter-2.1-internationalization-i18n,我用它来为网站提供多语言支持。我需要编辑我的路由以使用删除方法名称的语言参数:

{domain}/{application}/{language}/{controller}/{method}/{parameter}
example: http://localhost/website/en/test/show/parameter

{domain}/{application}/{language}/{controller}/{parameter}
example: http://localhost/website/en/test/parameter

我在路线中设置了这个.php

$route['test/(:any)'] = "test/show/$1";
$route['default_controller'] = "home";
$route['404_override'] = '';    
$route['^(en|sk)/(.+)$'] = "$2";
$route['^(en|sk)$'] = $route['default_controller'];

问题:

当我使用:

http://localhost/website/en/test/show/parameter

这工作得很好。但我申请了

$route['test/(:any)'] = "test/show/$1";

现在当我使用

http://localhost/website/en/test/parameter

它不起作用。它显示 404 页面未找到。

感谢您的建议/代码。

溶液:

想出的解决方案:

编辑路线.php

$route['^(en|sk)/test/(:any)'] = "test/show/$2";

解决方案:

想出的解决方案:

编辑路线.php

$route['^(en|sk)/test/(:any)'] = "test/show/$2";