Development - Routing

ApPHP Framework always analyzes a URL received from the browser by splitting it into two parts:
  1. Main part: it is the URL including its domain name; in the above example it is
  2. Internal part: it is the remaining part following the installation URL; in the above examples it is page/, page/view/id/2, index.php?url=controller/action, etc.

By default, ApPHP Framework recognizes URLs with the following formats:

Variant 1 (The url GET variable can be retrived in a standard way, urlFormat "get"):
Variant 2 (urlFormat "get"):
Variant 3 (urlFormat "path"):
Variant 4 (You may specify a custom format "shortPath" for URL by creating special definitions in configuration file):
// URL manager
'urlManager' => array(
    'urlFormat' => 'shortPath',  /* get | path | shortPath */
    'rules' => array(
        /* direct comparison */ 
        'controller/action/value1/value2' => 'controller/action/param1/value1/param2/value2',

        /* advanced template comparison: two or more parameters */ 
        'pages/view/(.*?)/(.*?)/(.*)' => 'pages/view/id/{$0}/param2/{$1}/param3/{$2}',
        'pages/view/(.*?)/(.*)' => 'pages/view/id/{$0}/param2/{$1}',

        /* simple template comparison */ 
        'page/vew/id/(.*[0-9])+' => 'index/page/id/{$0}',
        'page/vew/id/(.*[0-9])+/(.*?)' => 'index/page/id/{$0}',
        'page/vew/(.*[0-9])+' => 'index/page/id/{$0}',
        'page/vew/(.*[0-9])+/(.*?)' => 'index/page/id/{$0}',
        'page/(.*[0-9])+' => 'index/page/id/{$0}',
        'page/(.*[0-9])+/(.*?)' => 'index/page/id/{$0}',		
Remember, that rules are checked sequentially until the match rule is found, so you have to order them in a certain way to avoid overlapping. For example:
// This rule must be defined before
'pages/view/(.*?)/(.*?)/(.*)' => 'pages/view/id/{$0}/param2/{$1}/param3/{$2}',
// This rule must be defined after
'pages/view/(.*?)/(.*)' => 'pages/view/id/{$0}/param2/{$1}',
Also, for custom format you have to define all appropriate parameters in your Controller.