0
votes

I have a multilanguage site built in Codeigniter. The current language is added to all urls. For example site.com/en/basic/user/subscription where "en" defines language. In routes.php I have the following:

$route['(\w{2})/(.*)'] = '$2';
$route['(\w{2})'] = $route['default_controller'];

Now I want to route all calls to: pro/user/* to basic/user/*. Pro and basic are folders, and user is the controller. I tried this one in routes.php, below the lines above.

$route['pro/user/(.*)'] = 'basic/user/$1';

I only get a 404. I have also tried different versions when adding language part, but can't get it to work. Tried using (:any) also.

1
Routes will run in the order they are defined. Higher routes will always take precedence over lower ones. Make sure there aren't any other routes above which are causing a 404. - TigerTiger
Here is codeigniter uri routing user guide codeigniter.com/user_guide/general/routing.html - Mr. ED

1 Answers

0
votes

I found a working solution. I put this rule above the language part.

$route['(.*)/pro/user/(.*)'] = 'basic/user/$2';