error 404 in my first yii app

Hi!

Can smb explain me why I see 404 in my first application?

Now I have 1 controller (SiteController) which consists of 2 actions (actionIndex & actionLogin).


Class SiteController extends CController {

   public function actionIndex() {

       $this->render('index');     //now it's static text like 'Hello world'

   }

   public function actionLogin() {

       $this->render('login');     // also consists static text in views/site/login.php

   }

}

When I try to open app_path/index - everything OK

But this variant app_path/login - error 404

Did you configure any URL rules? If not: Then your URLs are not supposed to work out of the box. See here, how to call a controller action through a "route":

http://www.yiiframework.com/doc/guide/basics.controller#route

Try app_path/site/login and see if that works (depends on if you have url re writing in your .htaccess) if not then try app_path/index.php?r=site/login

The reason why app_path/index works correctly is because Yii’s default Controller and Action is site/index which Yii automatically routes to if app_path/index is specified.

Before my first post I’ve read non-oficial article about MVC in Yii, so there wasn’t any words about routing. The autor just said: ‘go app_path/index & app_path/something_else’ that’s all.

Now i’ve understood the essence of the problem :)

2nd variant (app_path/index.php?r=site/login) works well.

GDzyne, Mike: thanks for a help.