I am new in Yii . I have created a URL http://enqphp.intermesh.net/enquiry/createFolder in my main.php file to redirect to an action ,but its redirecting to index action only by default .while when I am calling the same like http://enqphp.intermesh.net/index.php?r=/enquiry/Enquiryser/createFolder its working fine . When I print $_REQUEST
in my action I am getting
Array ( [r] => /enquiry/Enquiryser/index )
in index action .
Below is the code that I have used for redirection:
//'caseSensitive' => true,
//'urlSuffix' => '/',
//'showScriptName' => false,
'urlFormat' => 'path',
'rules' =>
array(
'/' => array('site/index'),
/* my files starting from here */
//'/enquiry/createFolder/'=>'enquiry/Enquiryser/CreateFolder',
'/enquiry/createFolder/' => array('enquiry/Enquiryser/CreateFolder'),
'enquiry'=>array('enquiry/Enquiryser/index'),
'<modules>/<controller:\w+>/<id:\d+>' => '<modules>/<controller>/view', '<modules>/<controller:\w+>/<action:\w+>/<id:\d+>' => '<modules>/<controller>/<action>',
'<modules>/<controller:\w+>/<action:\w+>/*' => '<modules>/<controller>/<action>',
),
)
can anyone please help me, what is the issue ?
You are specifying the module->controller->action
in your rules as an Array
; it should be a String
.
So your rules should look something like this
'/enquiry/createFolder/' => 'enquiry/Enquiryser/CreateFolder',
'enquiry'=> 'enquiry/Enquiryser/index',