Problem with urlManager

hi, i have a urgent problem right now. I can not access several link in my site. The problem is yii can’t find some url which the view use more than one word with underscore as separator.

for example: i can access http://example.com/site/index but i can’t access http://example.com/usermanager/index. Is it possible have different name between views’s name and controller. for example:

controllers:

/protected/controllers/UserManagerController.php

views:

/protected/views/user_manager/index.php

this is my example site:




http://jcross-indo.com/blog567



Please try to click "User Manager" and "Detail User" menu.

thanks.

How did you try to achieve this? Show the code behind your urlmanager in your config

this is my code:




'urlManager' => array(

                        'caseSensitive' => false,

			'showScriptName' => false,			

			'urlFormat'=>'path',

			'rules'=>array(

				'' => 'site/index',	

				'<view>' => array('site/page'),

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

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

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

			),

		),



I’ve been trying solve this problem about 10 hours. It runs well on my localhost. It gets error. This my .htaccess code:




Options +FollowSymLinks

IndexIgnore */*

<IfModule mod_rewrite.c>

RewriteEngine on


# if a directory or a file exists, use it directly

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d


# otherwise forward it to index.php

RewriteRule . index.php

</IfModule>



and permision to all folder is 755

Thanks

You have an issue with the caseSensitive attribute.

Try this on your site:

http://jcross-indo.com/blog567/index.php?r=UserManager/index

Can you paste the code for your menu here.

thanks you

but i have set option of caseSensitive to false in the urlManager. :rolleyes:

this is my code for menu:




	<div id="mainmenu">

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

			'items'=>array(

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

				array('label'=>'User Manager', 'url'=>array('/usermanager/index')),

				array('label'=>'Detail User', 'url'=>array('/usermanager/view')),

				

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

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

				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)

			),

		)); ?>

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



how about if i rename view’s folder to “user_manager” and in the controller i set the render like this:




$this->render('/user_manager/index');



Is it going to work?

thanks again

I don’t think so!

Looking at your site none of your urls are friendly urls. Are you sure that you have removed the comments around the urlManager config in your main.php?

oops, sorry now i have already change. this is my code for UserManagerController.php




<?php


class UserManagerController extends Controller

{

	public function actionIndex()

	{

		$this->render('/user_manager/index');

	}


	public function actionView()

	{

		$this->render('/user_manager/view');

	}

}

?>



thanks

You should probably have something like:


class UserManagerController extends Controller

{

        public function actionIndex()

        {

                $this->render('index');

        }


        public function actionView()

        {

                $this->render('view');

        }

}

Don’t rename the view folder and rather leave it as it was generated by the gii/yiic. What you are trying to achieve should only be achieved via the urlManager config. Can you please post the name of the view folder for this controller

keep your menu as:


array('label'=>'User Manager', 'url'=>array('/usermanager/index')),

array('label'=>'Detail User', 'url'=>array('usermanager/view')),

Ok, i’ll do it

Ok, i’ll keep the name as it was generated by the gii/yiic.

but i have try to access after i set urlManager and it’s always error

i try this link http://jcross-indo.com/userManager/index (error) and http://jcross-indo.com/usermanager/index (error too) and http://jcross-indo.com/Usermanager/index (same error)

this the name of views:

/protected/views/user_manager/index.php

/protected/views/user_manager/view.php

thanks again :)

sorry for bad english

this is strange. I would’ve expect the views to be something like:

/protected/views/userManager/index.php

/protected/views/userManager/view.php

Can you set them as above and let me know the result

I could not figure out and it’s not make sense, how this could happen.

on my localhost, everything works well

Are you sure that your localhost code is synchronized with your remote server? Do one last synchro and try again cause I am running out of suggestions

I’m sure my local code is same with server code. But i’m not sure my local server configuration is same with server configuration.

on local i’m using XAMPP Lite v1.7.3 and on server i’m using centOS linux with php 5.3.1

thanks