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 yii 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.
- 'journey',
- 'invite',
- '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 this,
<controller:\w+>/<id:\d+>
i.e. what is controller in url and what does 'w+' mean ?
A reference to guide will help too.
Edited after bool.dev's suggestion:
Changed the code , as you said (I tried that earlier too, removing all default rules). Now my url manager is like,
'/' => 'site/journey',
'journey/invite' => 'site/invite',
'journey/linkedin' => 'site/linkedin',
'<controller:\w+>/<id:\d+>'=>'view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
But it throws an error
"Warning: require_once(): open_basedir restriction in effect. File(/var/xyz.com/../yii/framework/yii.php) is not within the allowed path(s): (/usr/share/php:/usr/share/pear:/usr/share/php/libzend-framework-php:/var/*/tmp:/var/xyz.com) in /var/xyz.com/journey.php on line 12 Warning: require_once(/var/xyz.com/../yii/framework/yii.php): failed to open stream: Operation not permitted in /var/xyz.com/journey.php on line 12 Fatal error: require_once(): Failed opening required '/var/xyz.com/../yii/framework/yii.php' (include_path='.:/usr/share/php:/usr/share/php/libzend-framework-php') in /var/xyz.com/journey.php on line 12'
when I do xyz.com/journey/invite
or even xyz.com/journey
Edit:
It was a permission issue, @bool.dev's suggestion to put specific rules on top worked :)