Basic url re-write

I am new to php, new to mvc, new to yii, and new to url-rewriting. So, I am sorry, if I am asking something very basic.

I have hide the index.php (from the htaccess method discussed in forums)

In my urlmanager, I have this,


 'urlFormat'=>'path',

			'rules'=>array( 

				'<controller:\w+>/<id:\d+>'=>'view',

				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>' 

			),

			'showScriptName'=>false,

I have 3 files in view/site folder.

  1. ‘journey’,

  2. ‘invite’,

  3. ‘linkedin’.

Now, my home page should redirect to ‘journey’ action (i.e. should open the ‘site/journey.php’)

So, I guess, this would be


'/' => 'site/journey'

. It works too.

Now, I want ‘journey/invite’ should invoke the ‘invite’ action i.e. should open ‘site/invite.php’

And, ‘journey/linkedin’ should invoke the ‘linkedin’ action i.e. ‘site/linkedin.php’.

but,


 'journey/invite' => 'site/invite',

     'journey/linkedin' => 'site/linkedin'

is not working.

Also, can someone help me understand these


<controller:\w+>/<id:\d+>

i.e. what is controller in url and what does ‘w+’ mean ?

A reference to guide will help too.

Make sure invite and linked in are proper actions in the site controller as:

public function actionInvite() { } and public function actionLinkedIn(){ }

<controller:\w+>/<id:\d+> is just for example purpose there in the config file…

\w+ means any words (alphanumeric + underscore)

Did you put your new rules at the top of existing rules ie:




 'urlFormat'=>'path',

                        'rules'=>array( 

                                'site/invite' => 'journey/invite',

                                'site/linkedin' => 'journey/linkedin'

                                '<controller:\w+>/<id:\d+>'=>'view',

                                '<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

                                '<controller:\w+>/<action:\w+>'=>'<controller>/<action>' 

                        ),

                        'showScriptName'=>false,