CodeIgniter URI Routing (Dynamic, Multilingual)

I am trying to redirect all routes to one main controller. Here are my .php routes

$route['default_controller'] = "main";
$route['scaffolding_trigger'] = "";

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

$route['(en|ge)/(:any)'] = $route['default_controller']."/index/$1";
$route['(:any)'] = $route['default_controller']."/index/$1";

I need the language identifier to be passed with every link (e.g .: http://site.com/en/hello-world )

Here is my main controller:

class Main extends Controller
{
    function __construct()
    {
        parent::Controller();       
    }

    function index($page_type=false, $param=false) 
    {
        die($page_type.' | '.$param.'| Aaa!');  
    }
} 

I want to check if a predefined file type exists (for example: http://site.com/en/archive/05-06-2010 - here the predefined type will be an archive), then do something. If not, then search the database for slug. If not found, go to 404.

The problem is that I cannot get the parameters of the index function ($ page_type, $ param). Thanks for the help.

+5
1

, , $this->uri->segment(n)? n - , URI, .. http://site.com/1/2/3/4/...

, .

. CodeIgniter - URI- :

http://codeigniter.com/user_guide/libraries/uri.html

.

+2

All Articles