質問

I have a CI project where I have a set of custom routes which I want to alias/mirror for another base URL, i.e.

$route['admin/results'] = "client_results";
$route['admin/results/user/:any'] = "client_results/user_results"; ...

and:

$route['client/results'] = "client_results";
$route['client/results/user/:any'] = "client_results/user_results"; ...

I would like to know whether there is some way to shortcut the duplication or routes and combine the rules into a single 'set' for both /admin and /client base URLs? In totla I have >30 routes for this part of the site so combining them into a more intelligent declaration would be a real bonus.

役に立ちましたか?

解決

I think you can just use wildcards for the duplicated checks.

$route['(:any)/results'] = 'client_results';
$route['(:any)/results/user/(:any)'] = 'client_results/user_results/$2';
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top