Page Not Found Message Error

Hi everyone,

when I click one the menu item of my page, I get this error message "The requested URL /testYii/index.php/mywebpages/view/controllers/introduction was not found on this server". Could anyone help me fix the issue please?

My control file name is MywebpagesController.php and this is it content:




//MywebpagesController.php


<?php

	class MywebpagesController extends Controller

	{

		public function actionIndex()

		{

			$this->render('index');

		}

	

		public function actionIntroduction()

		{

			$this->render('introduction.php');

		}


		public function actionIntroduction()

		{

			$this->render('introduction');

		}

	}

?>

This is my /protected/views/layouts/main.php file content:


	<div class="backgroundGeneral">

		<div id="mainmenu">

			<?php $this->widget('zii.widgets.CMenu',array(

				'items'=>array(

					array('label'=>'Accueil', 'url'=>array('/site/index')),

					array('label'=>'Teaching', 'url'=>array('/mywebpages', 'view'=>'controllers/introduction')),

					array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),				

					array('label'=>'login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),

					array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest),

					array('label'=>'Forum', 'url'=>array('/site/pages/forum')),

					array('label'=>'Tools', 'url'=>array('/site/pages/tools')),

					array('label'=>'Contact', 'url'=>array('/site/contact')),

				),

			)); ?>

</div><!-- mainmenu -->



This is the /protected/config/main.php file content




return array(

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

	'name'=>'My web site',

	//gtf ... 'defaultController' => 'home',


	// preloading 'log' component

	'preload'=>array('log'),


	// autoloading model and component classes

	'import'=>array(

		'application.models.*',

		'application.components.*',

		'application.controllers.*', //

		'application.classes.*', //


	),

		'urlManager'=>array(

			'urlFormat'=>'path',

			'rules'=>array(

				'<controller:\w+>/<id:\d+>'=>'<controller>/view',

				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',

				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',

			),

			'showScriptName'=>true,

		),



Finally, I have the following configuration:


-/protected/views/site/pages/introduction.php

-/protected/controllers/MywebpagesController.php

Thank you in advance

Obviously, you have a wrong URL generated by Menu component.

The right one should be "/mywebpages/introduction".

I think you should change


'url'=>array('/mywebpages', 'view'=>'controllers/introduction')

to


'url'=>array('/mywebpages/introduction')

but check the documentation on this (I have no idea how zii.widgets work)

Thank you ORey for your answer. I set this url


'url'=>array('/mywebpages/introduction')

There is no longer error. Instead I’ve now a full white page.

You have two actions with the same name (I wonder why exception was not thrown), view in the unusual place and so on.

Plz start with the blog tutorial.


public function actionIntroduction()

                {

                        $this->render('introduction.php');

                }

remove this action from your controller I think this action is causing problem

I did not put the word "Controller" into the name of the controller file. That was the cause of the trouble.