Defaultcontroller Ignored?

I’m doing an extensive / change / update of my old application and at some point I’ve noticed, that links pointing to default controller (MainController in my case) actions are just not working.

Even though I have a definition in app’s configuration:





return array

(

	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

	'name'=>'Name',

    'defaultController'=>'main',



[size=2]whenever I click a link pointing to for example [/size]contact.html[size=2] (which should invoke [/size]contactAction[size=2] from [/size]MainController[size=2]) I’m getting 404 and Yii error “Unable to resolve the request “contact””. I have to add controller, even though it is default one, to get such links working.[/size]

I’m kind of lost, because this is first time (first Yii app), I’m running it such strange situation. Anyone got any idea, what can be wrong?

Though I had no reply to my topic, I add extra info, which maybe led someone to help me.

It seems, that at some stage, all default-behaviour in my application has failed.

Right now, I’ve noticed, that even default actions in a controllers are not invoked, and instead results in 404.

Though I have indexAction() defined in my controller, though it is actually copied from auto-generated application and though it claim (in a comment) that: “[size=“2”]This is the default ‘index’ action that is invoked when an action is not [/size][size=“2”]explicitly requested by users[/size][size=“2”]”, I can’t use this or any other controller without action part in route, because I’m getting 404 instead of executing default action.[/size]

[size=“2”]What can be wrong? Can this be somehow related to CUrlManager (though I haven’t touched its code – just tested that rules part is 100% the same as in auto-generated path)?[/size]

[size="2"]EDIT: Actually, it turns out, that everything fails with 404, if there is no controller and / or action exactly specified. Even login/logout functions fails, because – for some reason – Yii::app()->homeUrl and Yii::app()->user->returnUrl contains either empty string or just the application root folder, assuming to execute default controller and action, which fails in my case.[/size]

Post your controller actions names and your config. The default action works good, you must be missing something.

Default action is defined in Controllers, default Controller in config/main.php-.

class TestController extends CController

{

     public $defaultAction = 'test';


     public function actionTest()


   {


          // your default action page


   }

}

Maybe it’s a problem with your rewrite rules… If you have an app from scratch it works good… but there are no .html ending requests.

Thank you for your attempt to help and a bunch of information, that I’m already aware of.

I’ve been able to identify, that possible source of my problems is in implementing Hyphenation of routes in URL management, when [size=“2”]useStrictParsing is set to TRUE (as advised in mentioned example). Setting this parameter to FALSE (default value for CUrlManager) seems to be solving the problem and mentioned implementation also seems to be working fine without it.[/size]

[size="2"]So, I think, that would be all for now.[/size]