How can I solve routing in HMVC?

I am working on a cms project that will be used to publish news sites. I am using the i18n plugin for multilingual problems. the problem is routing. I have a module called news and a page method, and the route is set as

 $route['page/test'] = 'news/page/1'; 

it works without problems when I go to

 http://localhost/site/page/test 

The problems begin when I start using the i18n localization plugin. then it only works with this URL:

 http://localhost/site/en/news/page/test 

I want the url to be with the news segment. What can I do to solve this problem? Thanks in advance.

+4
source share
2 answers

This will work on any controller with or without a language string

 $route['^([az]{2})/(.*)'] = '$2'; $route['^([az]{2})'] = $route['default_controller']; 
0
source

It looks normal that it no longer works with the route because "/ en /" is missing

You tried to put:

 $route['en/page/test'] = 'news/page/1'; 

or

 $route['en/page/test'] = 'en/news/page/1'; 

(I do not know i18n firmware)

If this works, the solution can be used with a wildcard:

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

or

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

(again i don't know how plug i18n plug works)

0
source

Source: https://habr.com/ru/post/1401278/


All Articles