我正在开发一个 cms 项目,该项目将用于发布新闻网站。我正在使用 i18n 插件来解决多语言问题。问题出在路由上。我有名为 news
的模块和方法 page
,并且路由设置为
$route['page/test'] = 'news/page/1';
当我去时,这工作没有问题
http://localhost/site/page/test
当我开始使用 i18n 本地化插件时,问题就开始了。那么它只适用于这个网址:
http://localhost/site/en/news/page/test
我希望网址不含 news
段。我能做什么来解决这个问题?
提前致谢。
最佳答案
这适用于任何 Controller ,无论有或没有语言字符串
$route['^([a-z]{2})/(.*)'] = '$2';
$route['^([a-z]{2})'] = $route['default_controller'];
关于url-routing - 如何解决 HMVC 中的路由问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9694419/