Codeigniter URL重新映射以删除段

I have a codeigniter website where the request urls take the form:

example.com/segment1/segment2/segment3 where:

segment 1 is a folder name
segment 2 is a controller name
segment 3 is a function name

I want to remap these requests to:

example.com/segment2/segment3

I have tried this in my*routes.php* config:

$route['(:any)/(:any)/(:any)'] = "$2/$3/$1";

The reqyest that shows up in my browser's address bar is unchanged :

example.com/segment1/segment2/segment3

How can I fix this?

You can add this to your .htaccess file (as you mentioned your folder is static):

RewriteRule ^(.*)?/(.*)?$   your-folder-here/$1/$2   [L,NC]                                                 

This will work but this would overwrite every possible URLS.

$route['(:any)/(:any)'] = 'controller_name/$1/$2';

In order to make other controllers work, you have to define before the above statement

$route['other_controller_1/(:any)'] = 'other_controller_1/$1';
$route['other_controller_2/(:any)'] = 'other_controller_2/$1';

URI Routing : Codeigniter User Guide