0
votes

I am new to yii i have setup of sample yii demo application (default)n now i want to create new page but i am getting 404 error following are the steps i have followed.

1) In site Controller created new action

public function actionTest()
{
  $this->render('test');
}

2) created new page in view folder test.php

echo "test";

3) In main.php (config file) added following code

'urlManager' => array(

      'urlFormat' => 'path', 

      'showScriptName' => false,

      'caseSensitive' => false,

      'rules' => array(

      'test' => 'site/test',

      ),  
),

4) when i run the application with URL

http://localhost/YiiTest/test 

then got the error

The requested URL /YiiTest/test was not found on this server. 
1
I didn't tested, but aren't you missing the enablePrettyUrl set to true? - Clyff
Do you put your file test.php on protected/views/site folder? And your URL, localhost/folder/site/test? - Alejandro Quiroz
Yes @AlejandroQuiroz i have put my test.php on protected/views/site folder ,but still it is not working - Shashikant
Type in your browser localhost/YiiTest/site/test and try to load it - Alejandro Quiroz

1 Answers

0
votes

make sure you have rewrite your .htaccess file link